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
# Attempt1 | |
require 'rubygems' | |
Gem.clear_paths | |
ENV['GEM_HOME'] = `echo $GEM_HOME` | |
ENV['GEM_PATH'] = `echo $GEM_PATH` | |
require 'awesome_print' | |
class Array | |
def random | |
self[rand length] |
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
# Drop | |
class Player | |
attr_accessor :health, :x, :y, :width, :height | |
def initialize(args = {}) | |
args.each_pair {|k, v| send "#{k}=", v} | |
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
# Drop | |
class Player | |
attr_accessor :health, :x, :y, :width, :height | |
def initialize(args = {}) | |
args.each_pair {|k, v| send "#{k}=", v} | |
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
#!/usr/bin/env ruby | |
# Script to generate PDF cards suitable for planning poker | |
# from Pivotal Tracker [http://www.pivotaltracker.com/] CSV export. | |
# Inspired by Bryan Helmkamp's http://github.com/brynary/features2cards/ | |
# Example output: http://img.skitch.com/20100522-d1kkhfu6yub7gpye97ikfuubi2.png | |
require 'rubygems' |
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 TableDefinition(val name: String, val columns: Map[String, Class]) { | |
} | |
object TableDefinition { | |
val table_definitions = collection.mutable.Map[String, TableDefinition]() | |
def register(name: String, attributes: Map[String, Class]) { | |
TableDefinition.register(new TableDefinition(name, attributes) ) | |
} |
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
TableDefinition.register("SetSummaries", Map( | |
"SetID" -> java.lang.Integer, | |
"UserID" -> java.lang.Integer, | |
"ProgramNumber" -> java.lang.Integer, | |
"ProgramID" -> java.lang.Integer, | |
"SessionNumber" -> java.lang.Integer, | |
"SetNumber" -> java.lang.Integer, | |
"ExerciseID" -> java.lang.Integer, | |
"Skipped" -> java.lang.Boolean, | |
"PaceScore" -> java.lang.Integer, |
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
(defn calculate-change | |
([paid cost] (make-change paid cost 0)) | |
([paid cost denomination-index] | |
(let | |
[ | |
currency-values [ | |
[:hundreds 10000] | |
[:fifties 5000] | |
[:twenties 2000] | |
[:tens 1000] |
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
require 'rubygems' | |
class Array | |
def random | |
self[rand length] | |
end | |
end | |
class Hash | |
def random |
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
map = <<-EOS | |
. . . . . . . . . . . . . . . . | |
. . . . . . . . . . . . . . . . | |
. . . . . . . X X X X X X X . . | |
. . . . . . . X . . . . . X . . | |
. . . . . . . X . . . . . . . . | |
. . . . . . . X . . . . . X . . | |
. . . . . . . X . . S . . X . . | |
. . . . . . . X . . . . . X . . | |
. . . . . . . X X X X X X X . . |
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
// Let's have some fun with JavaScript. | |
{} + 0 | |
// => 0 | |
// That's a little strange, but okay. Surely nothing would change if I wrapped | |
// the whole thing in parens, right? | |
({} + 0) | |
// => "[object Object]0" |