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 Fibonacci | |
include Enumerable | |
def initialize | |
@this = 1 | |
@next = 1 | |
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
module MetaState | |
class Error < ::StandardError; end | |
class WrongStateError < Error; end | |
class InvalidStateError < Error; end | |
class Machine | |
NON_MESSAGES = [:on_exit, :on_enter] | |
class << self | |
def add_state(state) |
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
Here's the basic premises: invent as little cryptography as you can. Make the tools as simple as possible. | |
Here's the proposal: use PGP for agent authentication, use git for verification distribution. | |
The kernel of the idea is this: in a public git repo, any user can create file(s) that are a list of tuples of the form: | |
{domain,object identifier,public identity,signature} | |
When I release a gem, I sign it, and add | |
rubygems mygem-x.y.z [email protected] {signature} |
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
#!/bin/bash | |
for branch in $(git branch --merged | egrep -v '(master)|(staging)|(production)'); do | |
echo Cleaning: $branch | |
#If we can delete the branch remotely, delete it locally | |
git push origin :$branch && git branch -d $branch | |
done |
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
#!/bin/sh | |
BUNDLE_BASE=~/ruby/bundle-paths/rails3 | |
if [ -f .bundle/config ]; then | |
echo "Bundle config file already exists" | |
bundle install | |
else | |
projname=$(basename $(pwd)) | |
BUNDLE_PATH="$BUNDLE_BASE/lib" |
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
export PROMPT_DIRTRIM=2 | |
if [[ ! $PROMPT_COMMAND =~ __bundler_prompt_command ]]; then | |
export PROMPT_COMMAND="${PROMPT_COMMAND:-:} ; __bundler_prompt_command" | |
fi | |
# Put your fun stuff here. | |
PS1='\[\033[01;31m\]$(__bundler_ps1)\[\033[00;34m\]\[\033[32m\]\u@\h\[\033[34m\] \w\[\033[01;32m\]$(__git_ps1) \[\033[34m\]\$\[\033[00m\] ' |
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 align(string) | |
lines = string.split(/\n/) | |
first = lines.shift | |
match = /^(\s*)<<</.match(first) | |
unless(match.nil?) | |
return lines.map do |line| | |
unless /^#{match[1]}|^\s*$/ =~ line | |
raise Errors::UnderIndented, line | |
end | |
line.sub(/^#{match[1]}/, "") |
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 Uuu < RSpec::Core::Formatters::ProgressFormatter | |
def example_passed(example) | |
if @failed_examples.empty? | |
super | |
else | |
output.print red("u") | |
end | |
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
<p>I've recently gotten really excited about REST (or Hypermedia APIs) and about RDF. Here's a quick trail of breadcrumbs about why. Come be excited.</p> | |
<A HREF="http://vimeo.com/20781278" >Hypermedia APIs - Jon Moore on Vimeo</A> | |
<A HREF="https://gist.github.com/jonm/1445773" >Shallow vs. deep representations in XHTML Hypermedia APIs</A> | |
<A HREF="http://www.w3.org/TR/2011/WD-microdata-20110405/" >HTML Microdata</A> | |
<A HREF="http://markmail.org/message/mlf5fmvtkvaxa7co" >Re: [whatwg] Proposal to extend Microdata API specification - Ian Hickson - org.whatwg.lists.whatwg - MarkMail</A> | |
<A HREF="http://manu.sporny.org/2012/mythical-differences/" >Mythical Differences: RDFa Lite vs. Microdata | The Beautiful, Tormented Machine</A> | |
<A HREF="http://www.w3.org/TR/rdfa-lite/" >RDFa Lite 1.1</A> |
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
rspec ./spec/controllers/demo_impressions_controller_spec.rb:84 # DemoImpressionsController when a demo PG ad with offers is requested should render a PG ad that has offers | |
rspec ./spec/controllers/impressions_controller_spec.rb:137 # ImpressionsController with successful ad fetch with PG offer ads should render it's views and should load successfully | |
rspec ./spec/jobs/ad_cache_page_spec.rb:17 # AdCachePage should find appropriate Pricegrabber ads for page | |
rspec ./spec/jobs/refresh_page_spec.rb:28 # RefreshPage on a finished page should not raise error | |
rspec ./spec/jobs/refresh_page_spec.rb:34 # RefreshPage on a finished page should enqueue next job | |
rspec ./spec/jobs/refresh_page_spec.rb:40 # RefreshPage on a finished page should reset AdCachePage | |
rspec ./spec/jobs/refresh_page_spec.rb:47 # RefreshPage on a finished page should reset FinishPage | |
rspec ./spec/lib/ad_engine/ad_finder_spec.rb:228 # AdEngine::AdFinder get ads with no ilk given with a query should return ads of both pg and groupon | |
rspec ./spec/lib/ |