Public Gists by stonegao

Gravatar
Tue Nov 24 01:26:14 -0800 2009
1
2
3
def transform_hash(original, options={}, &block)
  original.inject({}){|result, (key,value)|
    value = if (options[:deep] && Hash === value)
Gravatar
Wed Sep 30 02:09:24 -0700 2009

      
Gravatar
Mon Aug 03 23:59:32 -0700 2009
1
2
3
class AddAttachmentsDataToWrapper < ActiveRecord::Migration
  def self.up
    add_column :wrappers, :data_file_name, :string
Gravatar
Sun Aug 02 09:11:26 -0700 2009
1
2
3
# download, from_repo, and commit_state methods swiped from
# http://github.com/Sutto/rails-template/blob/07b044072f3fb0b40aea27b713ca61515250f5ec/rails_template.rb
 
Gravatar
Sat Aug 01 03:53:32 -0700 2009
1
2
3
Ubuntu 8.10 Intrepid 32-bit server AMI taken from (http://alestic.com/): ami-7cfd1a15
 
Useful guides:
Gravatar
Sat Aug 01 03:51:05 -0700 2009
1
2
3
Installing Panda on your local machine or server
======================
 
Gravatar
Thu Jul 30 06:46:50 -0700 2009
1
2
3
# Demonstration of a handful of the metaprogramming features of Ruby.
#
# This code uses the same class/module configuration as Rails' standard
Gravatar
Tue Jun 30 23:03:31 -0700 2009
1
2
3
require 'rbconfig'
 
$stdout.sync = true
Gravatar
Thu Apr 16 00:47:54 -0700 2009
1
2
3
require 'rubygems'
require 'sinatra'
 
Gravatar
Sun Mar 29 23:43:05 -0700 2009
1
2
3
 with_options :order => 'created_at', :class_name => 'Comment' do |post|
    post.has_many :comments, :conditions => ['approved = ?', true], :dependent => :delete_all
    post.has_many :unapproved_comments, :conditions => ['approved = ?', false]