Skip to content

Instantly share code, notes, and snippets.

View timbogit's full-sized avatar

Tim Schmelmer timbogit

View GitHub Profile
@timbogit
timbogit / http_server_ex.go
Created May 8, 2013 03:49
Go tour HTTP Server exercise
package main
import (
"fmt"
"net/http"
)
type String string
@timbogit
timbogit / cubic_root_ex.go
Created May 7, 2013 15:13
Cubic Root exercise for Go lang tour
package main
import (
"fmt"
"math/cmplx"
)
func Cbrt(x complex128) complex128 {
z := complex128(1)
for i := 0; i < 100; i++ {
@timbogit
timbogit / maps_ex.go
Created May 7, 2013 04:01
Maps exercise in Go tour
package main
import (
"code.google.com/p/go-tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
res := make(map[string]int)
@timbogit
timbogit / slice_ex.go
Last active December 17, 2015 01:19
Go exercise for "Slices"
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
// allocate 'dy' row slices of []unit8
rows := make([][]uint8, dy)
for i, row := range rows {
// allocate 'dx' uint8 points in each row
row = make([]uint8, dx)
@timbogit
timbogit / eigenclasses.rb
Created March 8, 2012 05:19
Musing on the Ruby object model in Ruby 1.8.7 vs. 1.9.3
obj = Object.new
puts "obj is #{obj}"
eigobj = class << obj
self
end
puts "Eigenclass of obj is #{eigobj}"
puts "Superclass of the eigenclass of obj is #{eigobj.superclass}"
eigclassobj = class << obj.class