Public Gists by wmoxam

Gravatar
Tue Mar 31 10:41:02 -0700 2009
1
2
3
class ControllerHelper
  include Singleton
  include ActionView::Helpers
Gravatar
Fri Mar 27 15:37:42 -0700 2009
1
2
3
#!/usr/bin/ruby
dir = 'app/views/user_mailer/'
`ls #{dir}`.each_line do |f|
Gravatar
Thu Mar 05 11:52:24 -0800 2009
1
2
3
#!/usr/bin/env ruby
 
def running?(pid)
Gravatar
Tue Feb 24 10:50:15 -0800 2009
1
2
3
Find hotmail addresses to whom mail was rejected as spam.
 
grep hotmail * | grep spam | ruby -e 'e = []; STDIN.each_line {|s| s.match(/to=\<([^\>]*)\>/); e << $~[1] unless $~.nil? }; puts e.uniq.join("\n")'
Gravatar
Thu Feb 05 13:57:38 -0800 2009
1
2
3
lib/core_extensions.rb
 
class ::Object
Gravatar
Sun Jan 25 20:40:49 -0800 2009
1
2
3
require 'open-uri'
 
def read_zip(io)
Gravatar
Tue Dec 30 11:09:27 -0800 2008
1
2
3
#!/usr/bin/env ruby
 
command = '/opt/ruby-enterprise-1.8.6-20080810/bin/passenger-memory-stats'
Gravatar
Sun Dec 28 17:58:22 -0800 2008
1
2
3
1926 David Heinemeier Hansson
1615 Jeremy Kemper
 436 Rick Olson
Gravatar
Thu Dec 18 08:03:37 -0800 2008
1
2
3
#!/usr/bin/env ruby
#
# [passenger_processes]
Gravatar
Thu Dec 18 07:22:13 -0800 2008
1
2
3
#!/usr/bin/env ruby
#
# Be sure to configure this node in the plugin configuration
Gravatar
Wed Dec 17 13:01:04 -0800 2008
1
2
3
# Rails doesn't have a way to pre-generate javascript cache files
# This is lifted directly from rails ..
def write_asset_file_contents(joined_asset_path, asset_paths)
Gravatar
Tue Dec 16 12:57:27 -0800 2008
1
2
3
#!/usr/bin/ruby
 
# Horridly hacked together by David Smalley (david@davidsmalley.com) with bits pulled from the
Gravatar
Mon Dec 15 14:22:16 -0800 2008
1
2
3
#!/usr/bin/env ruby
 
require 'rubygems'
Gravatar
Sat Nov 15 12:26:25 -0800 2008
1
2
3
Rails
 
=============D
Gravatar
Mon Nov 03 08:03:54 -0800 2008
1
2
3
irb(main):001:0> class Foo
irb(main):002:1> def self.bar; p 'class'; end
irb(main):003:1> end
Gravatar
Fri Oct 31 09:21:53 -0700 2008
1
2
3
config.load_paths += Dir["#{RAILS_ROOT}/vendor/gems/**"].map do |dir|
  File.directory?(lib = "#{dir}/lib") ? lib : dir
end
Gravatar
Sat Oct 18 22:18:40 -0700 2008
1
2
3
rb(main):008:0> a = 0
=> 0
irb(main):009:0> b = 1
Gravatar
Tue Sep 30 07:59:24 -0700 2008
1
2
3
%w{ asian american european african australian }.each do |p|
  map.with_options :controller => :people, :people => p do |person|
 
Gravatar
Fri Sep 19 08:03:59 -0700 2008
1
2
3
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
Gravatar
Tue Sep 09 11:09:17 -0700 2008
1
2
3
"Back in the days of assembly language programming, the distance between what you intended as a programmer and how the computer forced you to express that intention was enormous. Every few lines you needed a little story to help you understand what the next few instructions really meant.
As programming languages progressed, moving the expression closer to what it really meant, the habit of commenting every few lines relaxed ...
... Someone asked me 'What percentage of your methods have comments?' I answered 'between 0 and 1 percent'..."