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/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 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 | |
| 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 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
| 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 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 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 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
| class Fibonacci | |
| include Enumerable | |
| def initialize | |
| @this = 1 | |
| @next = 1 | |
| 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
| Adding 1 10x10 times: 100 | |
| Adding 1 10x10 times: 100 | |
| user system total real | |
| evald 15.760000 0.000000 15.760000 ( 15.772606) | |
| block 15.920000 0.000000 15.920000 ( 15.926385) | |
| user system total real | |
| eval_string 10.070000 0.110000 10.180000 ( 10.184233) | |
| define_with_block 1.120000 0.020000 1.140000 ( 1.143636) |
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/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 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 | |
| if [ $# -lt 1 ]; then | |
| echo "Usage: $0 <cmd>" | |
| exit 17 | |
| fi | |
| session_idx=$(tmux display -p "#S") | |
| window_idx=$(tmux display -p "#I") | |
| pane_idx=$(tmux display -p "#P") |
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
| def self.build_pairs(rel) | |
| require 'pp' | |
| records = connection.select_all(sanitize_sql(rel.to_sql), "#{name} Load Pairs", []) | |
| records.map do |record| | |
| split = record.to_a.map do |key,value| | |
| key.split(".",2) + [value] | |
| end.group_by do |list| | |
| list.first | |
| end.values.map do |record| | |
| instantiate(Hash[record.map{|triple| triple[1..2]}]) |
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
| Put this at the top of your Rakefile | |
| class Rake::Application | |
| def display_error_message(ex) | |
| $stderr.puts "#{name} aborted!" | |
| $stderr.puts "#{ex.class}: #{ex.message}" | |
| $stderr.puts rakefile_location(ex.backtrace) | |
| $stderr.puts "Tasks: #{ex.chain}" if has_chain?(ex) | |
| $stderr.puts ex.backtrace.join("\n") | |
| end |