- Steve Losh's great post A Modern Space Cadet.
- Shift Parentheses section.
- You might want to skip the last
<autogen>
rule, as it makes typing uppercased words by holding the shift key a pretty terrible experience.
- You might want to skip the last
- Control/Escape section.
- KeyRemap4MacBook is now Karabiner.
- Shift Parentheses section.
- Using Linux? You can get pretty much the same results with xmodmap, just google around.
- Shif parentheses can be done in a similar way, I'll post my xmodmap config for them when I get home.
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 'rom' | |
require 'anima' | |
class User | |
include Anima.new(:id, :name, :tasks) | |
end | |
class Task | |
include Anima.new(:title) | |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'sinatra' | |
require 'active_support' | |
require 'haml' | |
require 'thin' | |
gem 'tmm1-amqp' | |
require 'mq' |
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 'haml' | |
require 'effigy' | |
require 'effigy/core_ext/hash' | |
template = Haml::Engine.new(%{%html | |
%head | |
%title | |
%body | |
%h1 |
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' | |
puts ENV["GEM_HOME"] | |
require 'mongoid' | |
require 'mongoid/version' | |
puts "Using Mongoid: #{Mongoid::VERSION}" | |
Mongoid.master = Mongo::Connection.new.db("mongoid_playground") | |
class Animal |
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
... | |
group :development do | |
... | |
gem 'rails3-generators' | |
gem 'haml-rails' | |
... | |
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
# | |
# Calls a function that is defined as a String | |
# | |
# 'ws.extranett.subdomain_for'.call('argument1', 'argument2') | |
# | |
# Will call the function subdomain_for bound on the object extranett | |
# with arguments 'argument1' and 'argument2' | |
# | |
String::call = (args...) -> |
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
# Earl: Strings that do web things | |
# | |
# | |
# Examples: | |
# | |
# text = "Blah blah http://tinyurl.com/4bnjzbu blah http://tinyurl.com/4tefu9f" | |
# | |
# text.urls # => ["http://tinyurl.com/4bnjzbu", "http://tinyurl.com/4tefu9f"] | |
# | |
# text.locations # => ["http://nutrun.com/weblog/2010/11/17/supercharged-ruby-console-output.html", "http://nutrun.com"] |
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
# Dynamic method stubbing | |
# user = Factory(:user) | |
# callbacks = User._create_callbacks.map(&:filter) | |
# stub_methods("user", callbacks) | |
def stub_methods(name, methods) | |
methods.each do |method| | |
eval "stub(#{name}).#{method}" | |
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
# Use this setup block to configure all options available in SimpleForm. | |
SimpleForm.setup do |config| | |
# you need an updated simple_form gem for this to work, I'm referring to the git repo in my Gemfile | |
config.input_class = "form-control" | |
config.wrappers :bootstrap, tag: 'div', class: 'form-group', error_class: 'error' do |b| | |
b.use :html5 | |
b.use :placeholder | |
b.use :label | |
b.use :input |
OlderNewer