My Recent Pastes (435 and counting)

Browse Pastes by technoweenie (435 and counting)


June 12, 2008
7:28PM EDT
by technoweenie

class Foo
  include ActiveModel::StateMachine

  state_machine do
    state :open
    state :closed

May 20, 2008
12:39PM EDT
by technoweenie

class << ActiveRecord::Base
  def concerns(*args)
    args.each do |concern|
      require_dependency "#{name.underscore}/#{concern}"
    end
  end
end

May 18, 2008
11:29AM EDT
by technoweenie

## your .git/config

[branch "master"]
        remote = origin
        merge = refs/heads/master
[branch "production"]
        remote = origin

April 18, 2008
4:57PM EDT
by technoweenie

## post-receive hook

/home/git/ruby/duplikate.rb mephisto "rel-0.8"

## duplicate.rb script

# get duplicate lib from [email protected]:technoweenie/duplikate.git

April 11, 2008
1:56AM EDT
by technoweenie

desc "freeze rails edge"
task :edge do
  ENV['SHARED_PATH']    = '../../shared' unless ENV['SHARED_PATH']
  ENV['GIT_FORK']     ||= 'rails'
  ENV['RAILS_PATH']   ||= File.join(ENV['SHARED_PATH'], 'rails')

  clone_path    = "[email protected]:#{ENV['GIT_FORK']}/rails.git"

March 28, 2008
5:31PM EDT
by technoweenie

$("a")
   .filter(".clickme")
     .click(function(){
       alert("You are now leaving the site.");
     })
   .end()
   .filter(".hideme")

March 28, 2008
9:38AM EDT
by technoweenie

class Foo
  state_machine :initial => :init do
    state :init
    state :start, :enter => :blah
    event :start, :from => :init, :to => :start
  end
end

March 27, 2008
4:00PM EDT
by technoweenie

class Foo
  state_machine :initial => :init do
    state :init
    state :start, :enter => :blah
    event :start, :from => :init, :to => :start
  end
end

March 26, 2008
9:51PM EDT
by technoweenie

>> t = Time.now.utc.xmlschema
=> "2008-03-27T02:50:01Z"
>> ActiveSupport::JSON.decode %({"a": #{t.inspect}})
=> {"a"=>Thu Mar 27 02:50:01 UTC 2008}

March 26, 2008
2:40PM EDT
by technoweenie

if @records.each do |record|
  puts record
end.empty?
  puts 'empty!'
end

March 26, 2008
12:45PM EDT
by technoweenie

onready do |doc|
  (doc / '.txaction_display') do
    livequery 'mouseover' do
      (self / '.editbutton').show if self['merchantid']
      (self / '.merge_icon').show
    end
    livequery 'mouseout' do

March 25, 2008
1:59PM EDT
by technoweenie

>> gem 'rails'
=> true
>> gem 'rails'
=> false
>> gem 'rails', '= 2.0.1'
Gem::Exception: can't activate rails (= 2.0.1), already activated rails-2.0.2]

March 10, 2008
1:19PM EDT
by technoweenie

#!/usr/bin/ruby

# Post your direct messages from certain users as public tweets
# 
# (ex) Broadcast DM's from tyler-durden and spacemonkey
#
#   $ ruby twitter_bot.rb project-mayhem:password

March 06, 2008
5:29PM EDT
by technoweenie

>> u.admin?
=> false
>> u.admin
=> false
>> u.admin = nil
=> nil
>> u.save

March 04, 2008
6:09PM EDT
by technoweenie

## my repo's post-receive hook
/home/git/ruby/duplikate.rb mephisto "rel-0.8"

## duplicate.rb
#! /usr/bin/ruby
require 'rubygems'
require 'lockfile'

Next page