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
first_name | last_name | employer | |
---|---|---|---|
Fred | Flintstone | Bedrock Quarry | |
Clark | Kent | The Daily Planet | |
Ralph | Kramden | Metro Bus | |
Joe | Friday | LAPD | |
David | Hansson | 37Signals | |
Jim | Weirich | EdgeCase |
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 mask(x)y=x.dup;y[6...-4]=y[6...-4].gsub(/./,'*');y 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
require 'set' | |
def distinct_sets(setlist) | |
Set.new( setlist.map{|s|Set.new(s)} ). | |
divide {|a,b| ! (a&b).empty? }.to_a. | |
map{|e|e.to_a.inject{|b,l|b|l}.to_a.sort{|a,b| if Numeric === a && Numeric === b | |
a <=> b | |
else | |
a.to_s <=> b.to_s | |
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
cons () { if [ -e Gemfile ]; then | |
be='bundle exec' | |
else | |
be="" | |
fi | |
if [ -x "script/console" ]; then | |
${be} ruby script/console ${1:-${RAILS_ENV:-development}} | |
else | |
${be} rails console ${1:-${RAILS_ENV:-development}} | |
fi |
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
# COMMUNITY CHALLENGE | |
# | |
# How would you test this Quiz#problem method? Only two rules: | |
# | |
# 1. The tests should fail if any part of the application breaks. | |
# For example: If "gets" is moved before "puts" then the tests should | |
# fail since that breaks the application. | |
# | |
# 2. You cannot change the Quiz class. But you can use whatever framework | |
# and tools you want for the tests. (RSpec, Cucumber, etc.) |
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
# image_size.rb | |
# | |
# Copyright (c) 2007 Rob Biedenharn | |
# Rob [at] AgileConsultingLLC.com | |
# Rob_Biedenharn [at] alum.mit.edu | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to | |
# deal in the Software without restriction, including without limitation the | |
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
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/env ruby -w | |
# | |
# Copyright (c) 2008 Rob Biedenharn | |
# Rob [at] AgileConsultingLLC.com | |
# Rob_Biedenharn [at] alum.mit.edu | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to | |
# deal in the Software without restriction, including without limitation the | |
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
NewerOlder