Skip to content

Instantly share code, notes, and snippets.

View minikomi's full-sized avatar
🍕
I like pizza

minikomi

🍕
I like pizza
  • Tokyo, Japan
View GitHub Profile
@minikomi
minikomi / test.go
Created April 16, 2012 06:46
Sorting triangles with an interface in go
package main
import (
"fmt"
"sort"
)
type Triangle struct {
h int
w int
package main
import "tour/tree"
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func Walk(t *tree.Tree, ch chan int)
// Same determines whether the trees
// t1 and t2 contain the same values.
http://hexawe.net/mess/200.Drum.Machines/drums.zip
http://hexawe.net/mess/samples/dr.dre%20kit.zip
http://hexawe.net/mess/samples/monowave.wav
http://machines.hyperreal.org/manufacturers/Moog/Rogue/samples/rogue2.zip
http://www.milkcrate.com.au/ub/casio_SK1.zip
http://www.milkcrate.com.au/ub/casio_vl-1.zip
http://machines.hyperreal.org/manufacturers/Roland/TR-505/samples/tr505.zip
http://machines.hyperreal.org/manufacturers/Akai/MPC/samples/drumulator.zip
http://machines.hyperreal.org/manufacturers/Akai/MPC/samples/jrsoundkit.zip
http://machines.hyperreal.org/manufacturers/Moog/Rogue/samples/rogue1.zip
@minikomi
minikomi / jquery.py
Created April 21, 2012 10:15
chaining funcitons memo
class Yo:
def __init__(self):
self.s = ""
def extend(self,str):
self.s = self.s+str
return self
@minikomi
minikomi / gist:2505719
Created April 27, 2012 04:21 — forked from j2labs/gist:2502467
abusing python functions
>>> def foo():
... foo.x = 0
... foo.total = lambda: foo.x
... def add(x):
... foo.x = foo.x + x
... return foo
... foo.add = add
...
>>> foo()
>>> foo.total()
package main
import "fmt"
func walkAsync(ch chan string, tree *Tree) {
if len(tree.children) == 0 {
ch <- tree.data
return
} else {
for _, c := range tree.children {
@minikomi
minikomi / sort_count.clj
Created May 2, 2012 09:40 — forked from isa/gist:2571012
Convert in less than 30 lines
Question: Convert following into the latter data structure in less than 30 lines:
List:
A, B, C
A, C, E
E, F, D
D, A, J
E, D, J
List
@minikomi
minikomi / memo.md
Created May 3, 2012 10:39
Re-compiling vim for osx
  1. wget / untar

  2. rbenv global system

  3. ./configure --prefix=/usr/local/ --enable-rubyinterp --enable-pythoninterp --with-features=huge LDFLAGS=-lresolv

  4. make && make install

  5. sudo mv /usr/bin/vim /usr/bin/vim.old

  6. sudo ln -s /usr/local/bin/vim /usr/bin/vim

  7. rbenv back to normal!

@minikomi
minikomi / roman.go
Created May 23, 2012 08:50
Reusing base types with new methods #golang
var numText = "zero one two three four five six seven eight nine ten"
var numRoman = "- I II III IV V VI VII IX X"
var aText = strings.Split(numText, " ", 0)
var aRoman = strings.Split(numRoman, " ", 0)
type TextNumber int
type RomanNumber int
func (n TextNumber) String() string {
return aText[n];
@minikomi
minikomi / jsonexport.go
Created June 1, 2012 07:38
Exporting and manipulating tagged json fields in golang
package main
import "fmt"
import "encoding/json"
type Test struct {
Test1 string
Test2 string `json:"special_json_name"`
test3 string
}