Skip to content

Instantly share code, notes, and snippets.

View skiz's full-sized avatar
🎯
Focusing

Josh Martin skiz

🎯
Focusing
View GitHub Profile
require 'rubygems'
require 'active_support'
require 'active_model'
class Stub
def self.generate(name, *attrs)
Object::const_set(name.intern, Class::new do
include ActiveModel::Serialization
include ActiveModel::Validations
attr_accessor *attrs
set :application, "myapp"
set :repository, "git@myhost.com:myapp.git"
set :user, 'deploy'
set :ssh_options, {:forward_agent => true}
# If you have previously been relying upon the code to start, stop
# and restart your mongrel application, or if you rely on the database
# migration code, please uncomment the lines you require below
mobile-warrior:storefront jmartin$ which ruby
/Users/jmartin/.rvm/rubies/ruby-1.9.2-head/bin/ruby
mobile-warrior:storefront jmartin$ gem install nokogiri
Building native extensions. This could take a while...
Successfully installed nokogiri-1.4.2
1 gem installed
Installing ri documentation for nokogiri-1.4.2...
Installing RDoc documentation for nokogiri-1.4.2...
mobile-warrior:storefront jmartin$ AUTOFEATURE=true autotest
loading autotest/cucumber_rails_rspec2
class CreateConfigurations < ActiveRecord::Migration
def self.up
create_table :configurations do |t|
t.string :key
t.text :value
t.timestamps
end
add_index :configurations, :key, :unique => true
end
#!/usr/bin/env ruby
require 'digest/sha1'
require 'rubygems'
require 'amatch'
require 'bio'
challenge_phrase = File.read('challenge.txt')
challenge_sha1 = Digest::SHA1.hexdigest(challenge_phrase)
words = File.read('dict.txt').split("\n").uniq
test_phrase = words.sort{rand <=> 0.5}[3..rand(10)+5].join(' ')