Skip to content

Instantly share code, notes, and snippets.

View actsasbuffoon's full-sized avatar

Michael Tomer actsasbuffoon

  • Maestro
  • Boston, MA
View GitHub Profile
@actsasbuffoon
actsasbuffoon / maze.rb
Created October 4, 2011 19:50
Maze generator inspired by Jamis Buck's presentation on algorithms
# 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]
@actsasbuffoon
actsasbuffoon / drop.rb
Created October 4, 2011 19:51
Simple game made with Ruby-Processing
# Drop
class Player
attr_accessor :health, :x, :y, :width, :height
def initialize(args = {})
args.each_pair {|k, v| send "#{k}=", v}
end
@actsasbuffoon
actsasbuffoon / drop.rb
Created October 4, 2011 20:00
Simple game made with Ruby-Processing
# Drop
class Player
attr_accessor :health, :x, :y, :width, :height
def initialize(args = {})
args.each_pair {|k, v| send "#{k}=", v}
end
@actsasbuffoon
actsasbuffoon / pivotal_cards.rb
Created November 14, 2011 15:49
A script to generate cards for Pivotal stories
#!/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'
@actsasbuffoon
actsasbuffoon / table_definition.scala
Created June 24, 2012 23:08
Trying to create a collection of classes. Not going too well.
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) )
}
@actsasbuffoon
actsasbuffoon / example.scala
Created June 24, 2012 23:38
Setting up a table definition
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,
@actsasbuffoon
actsasbuffoon / calculate_change.clj
Created August 26, 2012 00:17
My first attempt at Clojure. Suggestions/criticism welcome.
(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]
@actsasbuffoon
actsasbuffoon / maze.rb
Created December 20, 2012 12:17
A recursive backtracking maze generator made with Ruby-Processing. gem install ruby-processing rp5 run maze.rb
require 'rubygems'
class Array
def random
self[rand length]
end
end
class Hash
def random
@actsasbuffoon
actsasbuffoon / pathfinder.rb
Created December 20, 2012 12:23
Ruby implementation of Dijkstra's algorithm. http://en.wikipedia.org/wiki/Dijkstra's_algorithm
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 . .
@actsasbuffoon
actsasbuffoon / fun_with_javascript.js
Last active December 27, 2015 12:09
We've replaced Michael's JavaScript interpreter with Cthulhu. Let's see if he can tell the difference!
// 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"