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
import Debug.Trace | |
-- Problem 0 | |
helloWorld :: [Char] | |
helloWorld = "Hello World" | |
-- Problem 1 | |
myLast :: [a] -> a | |
myLast = head . reverse |
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
# Usage: | |
# (irb)> { "some" => [{"keys" => "with", "some" => ["values"]}]}.flarp | |
# => {"some.0.keys"=>"with", "some.0.some.0"=>"values"} | |
class Hash | |
def flarp(h = {}, prefix = nil) | |
each do |k, v| | |
new_k = [prefix, k].compact.join(".") | |
if v.is_a?(Array) || v.is_a?(Hash) |
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 Hash | |
def flarp(h = {}, prefix = nil) | |
each do |k, v| | |
new_k = [prefix, k].compact.join(".") | |
if v.is_a?(Array) || v.is_a?(Hash) | |
v.flarp(h, new_k) | |
else | |
h[new_k] = v | |
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 'formula' | |
class Mysql < Formula | |
homepage 'http://dev.mysql.com/doc/refman/5.6/en/' | |
url 'http://downloads.mysql.com/archives/mysql-5.6/mysql-5.6.10.tar.gz' | |
version '5.6.10' | |
sha1 'f37979eafc241a0ebeac9548cb3f4113074271b7' | |
bottle do | |
sha1 'e07b9a207364b6e020fc96f49116b58d33d0eb78' => :mountain_lion |
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
190988 | |
190755 | |
190706 | |
191474 | |
191480 | |
191479 | |
191477 | |
167433 | |
61434 | |
196577 |
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 ThingRepresentation < Representable::Decorator | |
include Representable::JSON | |
property :field | |
end | |
# This works great. | |
ThingRepresentation.new(Thing.new).to_json # => { "field": "thing value" } | |
# This does not work. |
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
// go-race | |
// width: `tput cols` | |
// height: `tput lines` | |
// Our generated maze needs to be just less than 1/2 the size of our | |
// terminal size, so we can have room to print walls. | |
// | |
// Each cell is an integer. Each wall on the cell (N, E, S, W) are | |
// represented by a bit. If a wall exists only on the north side, |
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
{"songs": [ | |
{ | |
"globalId": "gold-rush", | |
"name": "Gold Rush", | |
"written-by": "Bill Monroe", | |
"key": "a", | |
"chord-progression": [ | |
{"section-name": "A", "chords": [ | |
{"key-as-letter": "a", "key-as-roman": "I", "duration": 3.0}, | |
{"key-as-letter": "e", "key-as-roman": "V", "duration": 0.5} |
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 Parent | |
def self.print_name | |
puts self.name | |
end | |
def self.name | |
"Parent" | |
end | |
end |
NewerOlder