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
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
fieldset { display: block; } | |
.alternative { display:none; } | |
.alternative-selected { } | |
</style> |
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
One is the loneliest number that you'll ever do | |
Two can be as bad as one, well it's the loneliest number since the number one | |
Three is really not so bad, but it can still be lonely, and that's really sad | |
Four is really no big deal, so if you think it's lonely, then you'd best get real | |
Five is practically a crowd, and if you're tryin' to think, it can seem really loud. | |
Five is the loneliest number | |
Five is the loneliest number | |
Five is the loneliest number since the number four dum dum-dum dum-dum |
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
# Works much like Ruby's native Queue, but provides an #undeq | |
# method, which Ruby's own Queue does not have. | |
class ReversibleQueue | |
def initialize | |
@queue_array = [] | |
@threads_waiting = [] | |
@mutex = Mutex.new | |
end | |
# Push an object onto the tail of the queue |
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 | |
ColorNameSequence = %w[ | |
Black | |
Red | |
Green | |
Yellow | |
Blue | |
Magenta | |
Cyan |
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
# == config/initializers/require_limit_for_mysql_text.rb == | |
# Fail when an attempt is made to specify a MySQL text | |
# columnn in a migration without providing a :limit value. | |
# This helps to prevent accidentally defining a 64K column | |
# (default) when a 16MB or 4GB coumn is desired. | |
# Note that MySQL silently truncates the data when it is | |
# too long for the column, so problems are only apparent | |
# later when attempting to retrieve the data (if then). |
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 'yaml' | |
require 'benchmark' | |
def make_yaml_string(num_entries=500) | |
entry_nums = (0...num_entries).to_a | |
entry_nums.shuffle! | |
result = '' | |
entry_nums.each do |n| | |
result << "something_#{n}: #{Random.rand}\n" | |
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
class Trinary | |
class << self | |
def ~ ; ~new ; end | |
def -@ ; -new ; end | |
def +@ ; +new ; end | |
end | |
def initialize(digits=[]) | |
@digits = digits | |
end |
NewerOlder