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
### Keybase proof | |
I hereby claim: | |
* I am chad on github. | |
* I am chadfowler (https://keybase.io/chadfowler) on keybase. | |
* I have a public key whose fingerprint is 1B2A 172D C190 D9A4 2AEF 38D5 A03B AE7D 7559 8524 | |
To claim this, I am signing this object: |
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
class TheMigrationClass < AR::Migration | |
class Conference < ActiveRecord::Base | |
has_many :attendances | |
end | |
class Attendance < ActiveRecord::Base | |
end | |
def change | |
# normal migration code |
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
int switchPin = 8; | |
void setup() | |
{ | |
Serial.begin(9600); | |
pinMode(switchPin, INPUT); | |
} | |
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 'rubygems/package' | |
def write_package | |
open "/tmp/blah.rn", 'wb' do |io| | |
Gem::Package.open io, 'w' do |pkg| | |
#pkg.metadata = @spec.to_yaml | |
Dir["**/*"].each do |file| | |
next if File.directory? file | |
stat = File.stat file |
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
def create | |
@user = User.new(params[:user]) | |
pw_match! | |
if @user.save | |
flash[:notice] = "User created" | |
redirect_to admin_url | |
else | |
render :action => "new" | |
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
module ActiveSomething | |
class Base | |
def self.setup_methods! | |
columns = File.readlines("#{self.name}.schema").map do |line| | |
line.chomp.split(/:/) | |
end | |
columns.each do |name, column_type| | |
instance_eval{attr_accessor name} | |
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
require 'pathname' | |
class FileDB | |
class ModuleDefiner | |
class ClassDefiner | |
end | |
end | |
class << self | |
def from_dir(path) | |
with_module_for(module_name_for(path)) do |m| |
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 'test/unit' | |
class TestMe < Test::Unit::TestCase | |
end if | |
class Me | |
def a_method | |
end | |
false | |
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
def start | |
puts "Starting round #{@rounds + 1}" | |
say('start', 5) | |
3.times do |minute| | |
sleep 60 | |
say("Ending minute #{minute + 1}") | |
end | |
@rounds += 1 | |
end |
OlderNewer