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 translate(str) | |
tr_words = [] | |
words = str.split | |
words.each do |word| | |
if word =~ /^([bcdfghjklmnpqrstvwxz]+)(.*)/ | |
p word | |
p $1 | |
p $2 | |
tr_words.push($2 + $1 + "ay") | |
else |
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
# terminal: | |
rails new sample_app --skip-test-unit | |
cd sample_app | |
# add some gems to your Gemfile: | |
cat >> Gemfile | |
group :production do |
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
# why does Rails generate this... | |
def index | |
@users = User.all | |
respond_to do |format| | |
format.html # index.html.erb | |
format.json { render json: @users } | |
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
data = <<TEXT | |
Lion (10.7.1) | |
Mac OS | |
Mac osx | |
Windows 7 | |
Mac osx, leopard | |
Linux | |
OSX | |
OSX | |
Mac OSX (snow leopard) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Scaling preso</title> | |
<style> | |
html { | |
font-size: 7.68px | |
} |
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 "performance_monitor" | |
require "time" | |
describe PerformanceMonitor do | |
before do | |
@monitor = PerformanceMonitor.new | |
@eleven_am = Time.parse("2011-1-2 11:00:00") | |
end | |
it "takes about 0 seconds to run an empty block" do |
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 "performance_monitor" | |
require "time" | |
describe PerformanceMonitor do | |
before do | |
@monitor = PerformanceMonitor.new | |
@eleven_am = Time.parse("2011-1-2 11:00:00") | |
end | |
it "takes about 0 seconds to run an empty block" do |
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
Failures: | |
1) Erector::Rails a named route helper can be called directly | |
Failure/Error: text root_path | |
NameError: | |
Erector::Widget#to_s is deprecated. Please use #to_html instead. Called from /Users/chaffee/.rvm/gems/ruby-1.9.2-p180/gems/rspec-core-2.6.4/lib/rspec/core/formatters/base_text_formatter.rb:163:in `inspect' | |
undefined local variable or method `root_path' for #<Erector::InlineWidget:0x00000102b30828> | |
# ./lib/erector/rails3.rb:128:in `method_missing' | |
# ./lib/erector/inline.rb:28:in `method_missing' | |
# ./spec/rails_root/spec/rails_helpers_spec.rb:77:in `block (4 levels) in <top (required)>' |
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 HowManyLicks < QuestionForm | |
def content | |
overview do | |
title_element "How many licks?" | |
text_element "Please tell us how many licks it takes to get to the center of these things." | |
formattedcontent do | |
rawtext "<![CDATA[\n" | |
p do | |
a :href => "http://tootsiepop.com/instructions.html" do | |
b "Click here to read the instructions!" |
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 HowManyLicks < QuestionForm | |
def content | |
overview do | |
title_element "How many licks?" | |
text_element "Please tell us how many licks it takes to get to the center of these things." | |
formattedcontent do | |
rawtext "<![CDATA[\n" | |
p do | |
a :href => "http://tootsiepop.com/instructions.html" do | |
b "Click here to read the instructions!" |