So Rails Templates have been around now since 2.3.0. I have finally found the time to dig in and enjoy them, after watching Ryan Bates’ screencast episode 148.
Feel free to use my base_template or any of my rails generators which can be found at github.com/cblackburn. My template is pretty basic, but I’ve wanted a way to do this kind of thing for years. I used to write shell scripts to setup my default Rails applications. This is so much nicer!
To use it just do this:
rails appname -m http://github.com/cblackburn/rails-templates/raw/master/base_template.rb
# Plugins
plugin 'exception_notifier', :git => 'git://github.com/rails/exception_notification.git'
# Gems
if yes?("Will you need to paginate?")
gem "mislav-will_paginate", :lib => 'will_paginate'
end
rake("gems:install", :sudo => true)
# Generators
generate :app_layout
if yes?("Will you be using MySQL?")
db_password = ask("What is the MySQL password for root?")
puts "Type 'y' and Enter to overwrite the current database.yml file."
generate( "database_yml_mysql #{db_password}") # This uses my own generator
end
if yes?("Do you need Authlogic?")
generate :authlogic # This uses my authlogic-generator
end
generate :controller, "home index"
route "map.root :controller => :home"
# General cleanup
rake "db:create:all"
rake "db:migrate"
run "echo TODO > README"
run "rm -f public/index.html"
# Files
file ".gitignore", <<-END
.DS_Store
log/*.log
log/*.pid
tmp/**/*
config/database.yml
db/*.sqlite3
END
# Git
git :init
git :add => "."
git :commit => "-m 'initial commit'"
If you decide to use this you’ll also want to take a look at my generators: http://github.com/cblackburn/personal-rails-generators
First, Merry Christmas! Now, my "bah humbug"!
I despise adware. Its not that it is evil, in and of itself. Its just that, well, it is irritating to be exposed to someone's attempt at persuading me that I need to buy something. Look, if I have a need for something, it is quite simple to research the existing products that fulfill that need, decide and make the purchase. Do we really need to put up with the corporate propaganda stream just to use otherwise "free" software?
Since NetNewsWire switched their model to adware, I'd been looking for something to replace it. Why didn't I just pay the fee to remove the ads, you may ask? Because Newsgator doesn't offer that option. Nope, if you want to use NetNewsWire you must eat their adstream while doing it.
I had used Vienna before. It wasn't as polished then, but they have done some great work and now it is, for my needs, every bit as good as NetNewsWire. The fact that it isn't adware made the choice simple. The interface is simple and clean and serves my purposes very well.
Some features:
- Subscribe to Atom/RSS news feeds and podcasts.
- Simple and intuitive user interface with customisable toolbar.
- Built-in tabbed browser.
- Global search of all retrieved articles.
- Automatic detection of newsfeeds on web pages.
- Smart folders for organising related feed articles.
- Custom article display styles.
- Three separate reading layouts.
- Blogging integration.
- Support for downloading enclosures in articles
- Filter the displayed articles.
- Manual reordering of the subscription list.
- Full AppleScript support.
- Localised into several languages.
So if you are tired of being forced to eat ads while reading your RSS feeds, switch to Vienna. You'll be glad you did.
Tags: adware, vienna, netnewswire, newsgator, rss readers, feed readers
While working on a project I found it necessary to generate some custom Google map markers and I wanted them numbered 1..999. I searched for a while and found a few php scripts and some snippets here and there, none of which did quite what I wanted. I decided to write my own. Here it is for your own mapping pleasure:
I saved mine as
gen_google_markers.rb. This is quick and dirty but it does what I wanted. If you use it and make it better please send me a patch or just a note to let me know what you did so I can improve my version as well.
#!/usr/bin/env ruby
require 'rubygems'
require 'rmagick'
include Magick
WIDTH = 33
HEIGHT = 37
FONT_COLOR = "#000000"
MARKER_COLOR = "#CC0000"
def generate_marker(num, font_color, marker_color)
throw "Number too big [#{num}], can only be 3 digits maximum." if num > 999
canvas = Image.new(WIDTH, HEIGHT) {
self.background_color = 'transparent'
# self.background_color = 'white'
}
gc = Draw.new
gc.fill_opacity(100)
gc.fill(marker_color)
gc.stroke('none')
gc.stroke_width(1)
# Draw triangle
gc.path("M#{WIDTH*0.091},#{HEIGHT*0.433} L#{WIDTH/2},#{HEIGHT*0.966} L#{WIDTH*0.909},#{HEIGHT*0.433} z")
# Draw ellipse on top of triangle
gc.stroke(marker_color) # set stroke to fix the offset where elipse meets triangle
gc.ellipse(WIDTH/2, HEIGHT*0.313, WIDTH*0.455, HEIGHT*0.267, 0, 360)
# Annotate
pointsize = (WIDTH*1.0/2) - 2
gc.fill(font_color)
gc.stroke('none')
gc.pointsize = pointsize
gc.gravity = NorthGravity
gc.text_align(CenterAlign)
gc.text_antialias(true)
gc.text(WIDTH/2, (HEIGHT/2)-(HEIGHT/20), "#{num}")
# Write file
gc.draw(canvas)
canvas.write("#{num}.png")
end
marker_color = ARGV.shift
font_color = ARGV.shift
for num in 1..999
generate_marker(num, font_color, marker_color)
endHappy mapping…

