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
Verifying that +kerryb is my blockchain ID. No, me neither. https://onename.com/kerryb |
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
Erlang R15B (erts-5.9) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false] | |
Eshell V5.9 (abort with ^G) | |
1> c(doubler). | |
{ok,doubler} | |
2> c(monitor). | |
{ok,monitor} | |
3> | |
3> monitor:start(). | |
new |
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
$ gem -v | |
<internal:lib/rubygems/custom_require>:32:in `rescue in require': undefined method `try_activate' for Gem:Module (NoMethodError) | |
from <internal:lib/rubygems/custom_require>:29:in `require' | |
from /usr/local/lib/ruby/site_ruby/1.9.1/rubygems.rb:32:in `<top (required)>' | |
from <internal:lib/rubygems/custom_require>:29:in `require' | |
from <internal:lib/rubygems/custom_require>:29:in `require' | |
from /usr/local/bin/gem:8:in `<main>' | |
$ ruby -d -rubygems -e 'puts 42' |
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
data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] | |
chunk_size = 3 | |
chunked_averages = (0...data.length).zip(data).group_by{|a| a.first / chunk_size}.values.map{|a| a.map(&:last).reduce(&:+) / a.size} |
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 DynamicSetup | |
def dynamic_setup_complete? | |
@dynamic_setup_complete | |
end | |
def method_missing name, *args, &block | |
if dynamic_setup_complete? | |
super | |
else | |
perform_dynamic_setup |
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 | |
# | |
# Number guessing game. | |
# A simple demo of bash capabilities | |
# | |
# neil.winton@bt.com | |
readonly MaxGuesses=6 | |
readonly Timeout=10 |
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
$ rake spec | |
(in /Users/kerry/tmp/foo) | |
/Users/kerry/ruby/bin/ruby -S bundle exec rspec ./spec/models/foo_spec.rb | |
F | |
Failures: | |
1) Foo shows the line that failed | |
Failure/Error: false.should be_true | |
expected false to be true |
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
namespace :code do | |
task :trailing_spaces do | |
grep "app", "spec" | |
end | |
def grep *file_patterns | |
files_found = "" | |
file_patterns.each do |file_pattern| | |
files_found << `grep -r -E '^.*[[:space:]]+$' --include '*.rb' #{file_pattern}` | |
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/ruby | |
#-*-ruby-*- | |
# A script to run ctags on all .rb files in a project. Can be run on | |
# the current dir, called from a git callback, or install itself as a | |
# git post-merge and post-commit callback. | |
CTAGS = '/usr/local/bin/ctags' | |
HOOKS = %w{ post-merge post-commit post-checkout } | |
HOOKS_DIR = '.git/hooks' |