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
| # Either as a mixin or a separate implementation for Array and Hash | |
| # this feels like something that should be in Ruby core. | |
| # A better implementation of this, obviously, with identical functionality | |
| module Lookupable | |
| def lookup(lookupindex,lookupvalue,returnindex) | |
| isarray = self.class == Array | |
| self.each_with_index {|element,index| | |
| record = isarray ? element : element.last | |
| if record[lookupindex]==lookupvalue then | |
| return record[returnindex] |
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
| 0xdbe89b2051535c084335a311ff0fdf7bcbe7f95f |
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
| package gossamy | |
| type Controller interface { | |
| // here go user events | |
| } | |
| type Arranger interface { | |
| func Arrange() | |
| // here go | |
| } |
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
| package main | |
| import ( | |
| "fmt" | |
| "image" | |
| "math" | |
| "time" | |
| "math/rand" | |
| "github.com/fogleman/gg" |
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
| dago1 = DAGObject.new | |
| puts "DIR #{dago1.cid}" | |
| dag1 = DAG.new( { a: 1, b: 2, c: 3 } ) | |
| puts "DAG #{dag1.cid}" | |
| dag2 = DAG.new( { artist: "Ramones", phrase: "Hey, ho! Let's go!" } ) | |
| puts "DAG #{dag2.cid}" | |
| dag3 = DAG.new( { country: "Australia", capital: "Canberra" } ) |