This file contains hidden or 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
# How to find out where a method comes from. | |
# Learned this from Dave Thomas while teaching Advanced Ruby Studio | |
# Makes the case for separating method definitions into | |
# modules, especially when enhancing built-in classes. | |
module Perpetrator | |
def crime | |
end | |
end | |
class Fixnum |
This file contains hidden or 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 hidden or 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 hidden or 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); | |
} | |
NewerOlder