Skip to content

Instantly share code, notes, and snippets.

pepper:showoff [ruby-1.9.2-p0@global] alex$ gem env
NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#default_executable= called from /Users/alex/.rvm/gems/ruby-1.9.2-p0@global/specifications/cheat-1.3.0.gemspec:10.
NOTE: Gem::Specification#default_executable= is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::Specification#default_executable= called from /Users/alex/.rvm/gems/ruby-1.9.2-p0@global/specifications/rake-0.8.7.gemspec:10.
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.1
- RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [x86_64-darwin10.4.0]
- INSTALLATION DIRECTORY: /Users/alex/.rvm/gems/ruby-1.9.2-p0@global
- RUBY EXECUTABLE: /Users/alex/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
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!"
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!"
@alexch
alexch / gist:1088106
Created July 17, 2011 21:45
Erector Rails 3.1 Failures
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)>'
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
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
@alexch
alexch / index.html
Created August 26, 2011 01:02 — forked from nfiniteset/index.html
Pages that scale to fit window size
<!DOCTYPE html>
<html>
<head>
<title>Scaling preso</title>
<style>
html {
font-size: 7.68px
}
data = <<TEXT
Lion (10.7.1)
Mac OS
Mac osx
Windows 7
Mac osx, leopard
Linux
OSX
OSX
Mac OSX (snow leopard)
@alexch
alexch / respond_to.rb
Last active October 2, 2015 03:18
unbloating Rails' respond_to scaffolding
# 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
@alexch
alexch / gist:2161772
Created March 22, 2012 18:52
creating a new rails app for Michael Hartl's RailsTutorial
# terminal:
rails new sample_app --skip-test-unit
cd sample_app
# add some gems to your Gemfile:
cat >> Gemfile
group :production do