- Jim Weirich: The Building Blocks of Modularity – http://goo.gl/g4Nk
- Jim Weirich: SOLID Ruby – http://goo.gl/z3jd
- Sandi Metz: SOLID Object-Oriented Design – http://goo.gl/PDn6T
- Sandi Metz: Less – The Path to Better Design – http://goo.gl/VuTl4
- Demeter is for Encapsulation – http://is.gd/eeyLx
- Opinionated Modular Code – http://is.gd/eeyXm
- Scaling to Hundreds of Millions of Requests – http://vimeo.com/12814529
- Confident Code – http://goo.gl/VFLX
- Destroy All Software Screencasts – https://www.destroyallsoftware.com/screencasts
- Corey Haines: Fast Rails Tests – http://goo.gl/Va2gb
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
# Expand print panel by default | |
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true | |
# Disable the “Are you sure you want to open this application?” dialog | |
defaults write com.apple.LaunchServices LSQuarantine -bool false | |
# Enable subpixel font rendering on non-Apple LCDs | |
defaults write NSGlobalDomain AppleFontSmoothing -int 2 | |
# Disable press-and-hold for keys in favor of key repeat |
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
# The code can be seen here: gist.github.com/2711153 (it does use a small bit | |
# from the Rails framework, just for the persisted LedgerEntry and to create | |
# attribute readers). Some notes about the code: | |
# - Each Role is a class, having only (public) class methods. To help | |
# avoid them being called outside of their Context, a Role Method only has | |
# access to its associated object while the role's context is the | |
# current/active global context. | |
# - Following Trygve's approach: "Roles are referenced by name. If I mean | |
# the Role I write the role name, not 'self'." | |
# - For referencing the object playing a role, I've overridden the Role's |
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
#model / Data object | |
class User | |
attr_reader :name, :approved | |
def initialize name | |
@name = name | |
@approved = false | |
end | |
def approved? |
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
# Framework | |
# =========================================== | |
module ContextAccessor | |
def context | |
Thread.current[:context] | |
end | |
end | |
module Context | |
include ContextAccessor |
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
# This way we re-query the app itself in order to avoid sequential execution for CPU-intensive tasks | |
# that can (and should) be executed in parallel. | |
# | |
# Pros: decent scalability can be achieved by assigning path=some.load.balancer.com (i.e. Amazon ELB) | |
# and putting a bunch of multicore machines behind it. | |
# | |
# Cons: we lose some fraction of time on JSON encoding/decoding and HTTP traffic. | |
# Load-balanced fault-tolerant DRb could be a better choice, but would require more work and provide only | |
# minor performance improvement in situation where JSON/HTTP aren't the main CPU consumers. |
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 ActionDispatch::Routing::Mapper | |
def draw(routes_name) | |
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb"))) | |
end | |
end | |
BCX::Application.routes.draw do | |
draw :api | |
draw :account | |
draw :session |
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
#lib/active_support/cache/no_store.rb | |
module ActiveSupport | |
module Cache | |
class NoStore < Store | |
def read_entry(name, options) | |
return nil | |
end | |
def write_entry(name, value, options) | |
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
class S;def initialize *w;@s=w;end;def method_missing *w;@s<<w;self ########### | |
end;def to_ary;[@s.map{|e|e=~/[\,\.\:\-\(\)\/\'\"]/?[e]:[" ",e]}.join.strip] ## | |
end;end;def Object.const_missing(c);S.new c;end ####### gist.github.com/2354740 | |
puts This.is.a.sentence.represented.by.a.Ruby.expression(".") ################# |
These commands are good as of 2010-11-18.
Homebrew http://mxcl.github.com/homebrew/
ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)"
http://developer.apple.com/technology/xcode.html