This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'RMagick' | |
require 'ruby-debug' | |
layout = "QWERT | |
YUIOP | |
ASDFG | |
HJKLNM | |
ZXCVB" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'authlogic' | |
require 'spec' | |
require 'active_record' | |
ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => 'test.db') | |
class User < ActiveRecord::Base | |
acts_as_authentic do |c| | |
c.validate_login_field = {:if => :active?} | |
c.validate_password_field = {:if => :active?} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
require 'rdiscount' | |
require 'haml' | |
require 'dm-core' | |
require 'sinatra-authentication' | |
use Rack::Session::Cookie, 'shhhhhhhhhhhhhhh~' | |
class Page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_merchant' | |
class Charge < ActiveRecord::Base | |
attr_accessor :auth_response, :capture_response | |
belongs_to :user | |
validate :credit_card_must_be_valid | |
validates_presence_of :billing_address | |
validates_presence_of :city, :message => "for billing address can't be blank" | |
validates_presence_of :state, :message => "for billing address can't be blank" | |
validates_presence_of :billing_zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rake --trace | |
(in /Users/erik/projects/spro/code/sproutrobot) | |
rake aborted! | |
no such file to load -- initializer | |
/Users/erik/projects/spro/code/sproutrobot/config/boot.rb:55:in `require' | |
/Users/erik/projects/spro/code/sproutrobot/config/boot.rb:55:in `load_initializer' | |
/Users/erik/projects/spro/code/sproutrobot/config/boot.rb:111:in `run' | |
/Users/erik/projects/spro/code/sproutrobot/config/boot.rb:11:in `boot!' | |
/Users/erik/projects/spro/code/sproutrobot/config/boot.rb:124 | |
/Users/erik/.rvm/rubies/ruby-1.8.7-p302/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bundle list | |
Gems included by the bundle: | |
* abstract (1.0.0) | |
* actionmailer (3.0.0) | |
* actionpack (3.0.0) | |
* active_merchant (1.5.2) | |
* activemodel (3.0.0) | |
* activerecord (3.0.0) | |
* activeresource (3.0.0) | |
* activesupport (3.0.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dreamer [Fischer], level [1], priority [19], policy [OTHER] | |
Dreamer [Cobb], level [1], priority [19], policy [OTHER] | |
Dreamer [Arthur], level [1], priority [19], policy [OTHER] | |
Dreamer [Yusuf], level [1], priority [19], policy [OTHER] | |
Dreamer [Saito], level [1], priority [19], policy [OTHER] | |
Dreamer [Eames], level [1], priority [19], policy [OTHER] | |
Dreamer [Ariadne], level [1], priority [19], policy [OTHER] | |
[Fischer] HIJACKED ! Open up my defense projections in my dream to the hijackers! | |
[Saito] sees Fischers defense projections at work in the dream at level [1] | |
[Saito] shot in level [1]. Following Cobb to level [2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# By default, Ruby invokes class methods based on the number of parameters, ignoring | |
# the parameter type. I was curious if I could implement the method invocation pattern | |
# used in Lisp's CLOS, where you can have multiple methods that each accepts the same | |
# number of paraemters, but with different types. | |
# | |
# Needs Ruby 1.9 | |
class Object | |
def self.defm(sym, *classes, &block) | |
@defm_methods ||= {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'fileutils' | |
Dir.foreach(FileUtils.pwd) do |f| | |
if f.match(/\.html\.erb$/) | |
new_name = f.gsub(/\.erb$/, ".haml") | |
`html2haml #{f} #{new_name}` | |
`rm #{f}` | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SproutRobot::Application.routes.draw do | |
resources :users do | |
collection do | |
post :set_zip | |
end | |
end | |
end |
OlderNewer