Public Gists by nate

Gravatar
Thu Nov 12 08:19:03 -0800 2009
1
2
3
# Should go in ~/.irbrc or similar
 
if ENV['RAILS_ENV']
Gravatar
Sun Oct 11 21:04:46 -0700 2009
1
2
3
# Old way, assumes that since this is a User test
# it should look for @user and use it in the
# macros if it's set. Otherwise it instantiates a
Gravatar
Wed Oct 07 11:33:12 -0700 2009
1
2
3
Factory.class_eval do
  def run (proxy_class, overrides) #:nodoc:
    proxy = proxy_class.new(build_class)
Gravatar
Fri Aug 21 07:08:50 -0700 2009
1
2
3
#!/bin/bash
 
# Manages the ferret server.
Gravatar
Tue Jun 16 11:35:09 -0700 2009
1
2
3
namespace :db do
  task :backup_name, :roles => :db, :only => { :primary => true } do
    now = Time.now
Gravatar
Fri May 22 14:07:50 -0700 2009
1
*/2 * * * * cd /path/to/app/current && RAILS_ENV=production_or_whatever /path/to/ruby /path/to/rake ar_sendmail
Gravatar
Fri May 22 14:03:51 -0700 2009
1
2
3
task :ar_sendmail do
  require 'config/environment'
  require 'vendor/gems/adzap-ar_mailer-2.0.2/lib/action_mailer/ar_mailer'
Gravatar
Sun May 10 20:04:02 -0700 2009
1
2
3
module Sinatra
  module Authorization
 
Gravatar
Sun May 10 18:45:47 -0700 2009
1
2
3
FlixCloud Gem
=============
 
Gravatar
Thu Apr 02 16:53:54 -0700 2009
1
2
3
njero - http://neverlet.be
sutto - http://blog.ninjahideout.com
zapnap - http://blog.zerosum.org
Gravatar
Thu Apr 02 10:56:19 -0700 2009
1
select * from information_schema.statistics where TABLE_SCHEMA = 'database_to_find_indexes_of' order by table_name;
Gravatar
Thu Apr 02 10:16:33 -0700 2009
1
2
3
require 'sinatra/metal'
 
class SinatraMetal < Sinatra::Base
Gravatar
Mon Mar 23 11:38:37 -0700 2009
1
2
3
# Banned for causing ADD problems
127.0.0.1 digg.com
127.0.0.1 reddit.com
Gravatar
Sat Mar 21 09:24:22 -0700 2009
1
2
3
SELECT col1, col2, col3
FROM table1
WHERE col1 IN ('z', 'x', 'y')
Gravatar
Sun Mar 15 17:51:07 -0700 2009
1
2
3
# Run as: ALL=true autotest
# or just: autotest
# Excludes some tests from running unless you set ALL=true in the environment
Gravatar
Sun Mar 15 17:48:37 -0700 2009
1
2
3
$ gdb -p &lt;process_id&gt;
 
call (int)rb_backtrace()
Gravatar
Sun Mar 15 17:45:42 -0700 2009
1
2
3
# Autotest that doesn't automatically run every test after a red then a green.
# Name this .autotest and put it in ~
 
Gravatar
Tue Feb 03 11:10:13 -0800 2009
1
2
3
# test.rb
# require 'report_test_error_asap.rb'
 
Gravatar
Mon Jan 05 08:43:43 -0800 2009
1
2
3
# Before you use this:
# gem install utility_belt
 
Gravatar
Fri Jan 02 21:33:36 -0800 2009
1
2
3
module ActiveRecordEachBy
  # This method lets you iterate over the results of a .find, in groups.
  # (Basically an interface to LIMIT.)