Skip to content

Instantly share code, notes, and snippets.

View jackdempsey's full-sized avatar

jack dempsey jackdempsey

View GitHub Profile
# best way to code: if event is nil, true, otherwise if event.user == user true, else false
# seems clear but is so vertically long for such a simple thing
if event
event.user == user
else
true
end
# nice and compact but wtf does it mean
uthor: Jack Dempsey <[email protected]>
Date: Thu Feb 25 18:55:58 2010 -0500
support rubygems download of 1.3.0 up to current (1.3.6
diff --git a/lib/capistrano/ext/ubuntu-machine/gems.rb b/lib/capistrano/ext/ubuntu-machine/gems.rb
index 728b52a..de26abe 100644
--- a/lib/capistrano/ext/ubuntu-machine/gems.rb
+++ b/lib/capistrano/ext/ubuntu-machine/gems.rb
@@ -1,13 +1,25 @@
if File.exists?("/opt/local/bin/identify")
Paperclip.options[:command_path] = "/opt/local/bin"
elsif File.exists?("/usr/local/bin/identify")
Paperclip.options[:command_path] = "/usr/local/bin"
elsif File.exists?("/opt/ImageMagick-6.5.5/bin/identify")
Paperclip.options[:command_path] = "/opt/ImageMagick-6.5.5/bin"
end
scope :top_level, where(:category_id => nil).includes(:subcategories)
scope :active, top_level.where("name != 'foo'")
# instead of
match 'privacy' => 'home#privacy', :as => :privacy
match 'about' => 'home#about', :as => :about
match 'faq' => 'home#faq', :as => :faq
match 'press' => 'home#press', :as => :press
# something like
actions_for :home => %w(privacy about faq press)
- match 'privacy' => 'home#privacy', :as => :privacy
- match 'about' => 'home#about', :as => :about
- match 'faq' => 'home#faq', :as => :faq
- match 'press' => 'home#press', :as => :press
+
+ def named_routes_for(hash)
+ hash.each do |controller, named_routes|
+ named_routes.each do |named_route|
+ match named_route => "#{controller}##{named_route}", :as => named_route
+ end
diff --git a/railties/lib/rails/generators/base.rb b/railties/lib/rails/generators/base.rb
index dfa0d57..e22ad82 100644
--- a/railties/lib/rails/generators/base.rb
+++ b/railties/lib/rails/generators/base.rb
@@ -1,3 +1,5 @@
+require 'pp'
+pp $:
require 'thor/group'
require 'rails/generators/actions'
git/rails master > git pull
Already up-to-date.
git/rails master > ruby ./railties/bin/rails new_app
create
create README
create .gitignore
create Rakefile
create config.ru
create Gemfile
create app
#!/usr/bin/env ruby
# Written by Kieran P
# http://github.com/KieranP
# http://twitter.com/k776
# http://k776.tumblr.com
#
# Feel free to fork and modify.
# If you do, send me a message on
# Github details changes and I'll
git/nanite master > ./bin/nanite-mapper -i -u mapper -p testing -v /nanite
[Sun, 31 Jan 2010 10:56:12 -0500] INFO: [setup] setting log level to INFO
[Sun, 31 Jan 2010 10:56:12 -0500] INFO: [setup] setting log level to INFO
[Sun, 31 Jan 2010 10:56:12 -0500] INFO: [setup] starting mapper
Starting agent console (mapper-50aa567bb32b76ed6d7137f09882d180) (Nanite 0.4.1.13)
ruby-1.8.7-p174 > request('/simple/echo') {|res| p res}
=> false
ruby-1.8.7-p174 >