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
| module Kernel | |
| def an(value) | |
| Thingy.new(value) | |
| end | |
| def none | |
| Nothing.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
| (unfinished bar) | |
| (defn foo [stuff incoming] | |
| (first | |
| (filter | |
| (fn [a-thing] | |
| (bar a-thing incoming)) | |
| stuff))) | |
| ;; this actually calls bar |
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
| module Blog | |
| Routes = Raptor.routes(Blog) do | |
| show :to => 'Post.find', :if => :post_not_cached | |
| end | |
| class PostNotCached | |
| def match?(id, cache_control) | |
| post = Post.find(id) | |
| post.updated_at =< cache_control | |
| 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
| module Blog | |
| Routes = Raptor.routes(Blog) do | |
| show :to => 'Post.find', :http_cache_requirement => :post_cached | |
| end | |
| class PostCached | |
| def match?(id, cache_control) | |
| post = Post.find(id) | |
| post.updated_at =< cache_control | |
| 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
| # caching constraint | |
| module Blog | |
| Routes = Raptor.routes(Blog) do | |
| show :to => 'Post.find', :unless :post_cached | |
| show :responder => NoContentResponder | |
| end | |
| class PostCached | |
| def match?(id, cache_control) | |
| post = Post.find(id) |
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
| #!/bin/bash | |
| # assuming `origin (push)` is a github url, | |
| # this opens the current branch on github's site, | |
| # ready for a pull request | |
| # only works on macs right now (it uses `open`) | |
| function parse_git_branch { | |
| git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' -e 's/)//' -e 's/(//' | |
| } |
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
| Isolation vs Rails: More Fastererer Speedy Mk II Edition | |
| There is a vast set of tools and patches to speed up Rails boot time. What happens if, instead of testing inside Rails, we isolate our specs from Rails? What benefits can be gained from isolating our testing? Whilst test execution time is an obvious benefit, there are more subtle nuances to isolation. |
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
| from Quartz import * | |
| import time as time | |
| KEYCODES = { | |
| #q12 | |
| #w13 | |
| #e14 |
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
| pc-3-97:raptor(8161m|master) $ bundle | |
| ERRRO: Gem bundler is not installed, run `gem install bundler` first. | |
| pc-3-97:raptor(8161m|master) $ gem install bundler | |
| Successfully installed bundler-1.0.21 | |
| 1 gem installed | |
| Installing ri documentation for bundler-1.0.21... | |
| Installing RDoc documentation for bundler-1.0.21... | |
| pc-3-97:raptor(8161m|master) $ bundle | |
| ERRRO: Gem bundler is not installed, run `gem install bundler` first. | |
| pc-3-97:raptor(8161m|master) $ cd .. |
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
| { | |
| :current_user => "CurrentUser.current_user" | |
| } |