My Recent Pastes (109 and counting)
Pastes by halorgium (109 and counting)
Below are the 15 most recent pasties by halorgium.
July 30, 2007
7:34PM EDT
by halorgium
View all 14 lines
module Net class HTTP unless method_defined?(:use_ssl) def use_ssl @use_ssl
July 30, 2007
12:12AM EDT
by halorgium
View all 17 lines
before_validation :normalize_color_fields private # could use refactoring to reduce redundancy
July 30, 2007
12:09AM EDT
by halorgium
View all 10 lines
before_validation :normalize_color_fields private # could use refactoring to reduce redundancy
July 26, 2007
1:56AM EDT
by halorgium
View all 6 lines
class Foo; include Singleton; attr_accessor :name; end # => nil Foo.instance.name = :foo # => :foo Foo.instance.name
July 19, 2007
6:56PM EDT
by halorgium
View all 39 lines
role :web, "server1", "server2", "server3" task :edit do file_to_edit = ENV["FILE"] || abort("Please provide a file to edit: cap edit FILE=/etc/hosts") abort "Please provide an absolute path to the file" unless file_to_edit[0] == ?/
July 19, 2007
4:48AM EDT
by halorgium
View all 13 lines
# Using edge activesupport >> require 'open-uri' => ["OpenURI"] >> Hash.from_xml(open('http://halorgium.net/test.xml'))
July 18, 2007
9:31PM EDT
by halorgium
View all 6 lines
desc "Get top 5 processes by real memory usage" task :mem_check do run %q{ ps axcmo pid,rsz,command | awk '{LIMIT = 1; if ($2 > LIMIT) printf $2/1024 "MB " $3 "\n"}' | sort -rn | head -n5 }
July 17, 2007
12:33AM EDT
by halorgium
View all 24 lines
# controller class TestController < ApplicationController def index @urls = %w{http://google.com/ http://halorgium.net}
July 13, 2007
11:59AM EDT
by halorgium
View all 31 lines
## Quiz [plaintext] http://www.rubyquiz.com/quiz131.html ## Answer
July 13, 2007
12:26AM EDT
by halorgium
View all 14 lines
/usr/lib/ruby/gems/1.8/gems/capistrano-1.99.3/lib/capistrano/configuration/connections.rb:118:in `execute_on_servers': undefined method `continue_on_error?' for nil:NilClass (NoMethodError)
from /usr/lib/ruby/gems/1.8/gems/capistrano-1.99.3/lib/capistrano/configuration/actions/invocation.rb:50:in `run'
from /usr/lib/ruby/gems/1.8/gems/capistrano-1.99.3/lib/capistrano/recipes/deploy/strategy/base.rb:43:in `send'
from /usr/lib/ruby/gems/1.8/gems/capistrano-1.99.3/lib/capistrano/recipes/deploy/strategy/base.rb:43:in `method_missing'
from /usr/lib/ruby/gems/1.8/gems/capistrano-1.99.3/lib/capistrano/recipes/deploy/strategy/remote.rb:29:in `scm_run'
July 11, 2007
6:46PM EDT
by halorgium
View all 6 lines
class Object def loop_for(time, &block) finish = Time.now + time yield while Time.now < finish end
July 11, 2007
6:58AM EDT
by halorgium
View all 64 lines
## app/controllers/application.rb class ApplicationController < ActionController::Base include MagicRoutes
July 11, 2007
6:42AM EDT
by halorgium
View all 26 lines
module EventsRoutes NAMES = [] %w{events event new_event edit_event}.map do |prefix| %w{url path}.each do |suffix| NAMES << "#{prefix}_#{suffix}"
July 03, 2007
10:13PM EDT
by halorgium
View all 8 lines
HELPERS_DIR = (defined?(RAILS_ROOT) ? "#{RAILS_ROOT}/app/helpers" : "app/helpers") # Extract helper names from files in app/helpers/**/*.rb def all_application_helpers
July 03, 2007
1:00AM EDT
by halorgium
View all 21 lines
## YAML [plaintext] --- - path: "lib/recipes" repo: "ssh://raptor.example.com/capistrano/recipes"
