Skip to content

Instantly share code, notes, and snippets.

View pricees's full-sized avatar

Ted Price pricees

View GitHub Profile
@pricees
pricees / interfaces_i18n.go
Created September 16, 2014 20:17
Go map of interfaces & fun method names
package main
import "fmt"
type Fooable interface {
foo() string
}
type Bar struct { }
@pricees
pricees / soa_love.rb
Last active August 29, 2015 14:07
View all the pull requests for all my repos for an organization. SOA Tool
# This app is a very small proof of concept to help distributed teams with
# many repos, in possibly many organizations, handle their gitflow.
#
# Don't hate my codes... contribute!
#
# Get started:
# 1. Create Gemfile
# 2. Run sinatra
# 3. Open browser
#
@pricees
pricees / fun_with_slices.go
Created October 17, 2014 20:52
fun with slices in Go
/*
* Fun with slices
*/
package main
import "fmt"
// Fun with Go Slices
func main() {
a := make([]int, 20, 40)
a[0], a[1] = 1, 2
@pricees
pricees / interfaces.go
Created October 17, 2014 22:59
Go: interfaces, structs, and type assertions
package main
import "fmt"
//
// What doth a human make.
//
type Header interface {
HasHead()
}
@pricees
pricees / sad_iran.go
Created October 18, 2014 02:40
The saddest gonuts
== Original Post ==
i am iranian
i can not access to golang.org or code.google.com with real ip .
i should for access the golang.org change ip
i'm very sad
in iran
golang Iranian experts how they communicate with you?
@pricees
pricees / type_assertion_cost.go
Last active August 29, 2015 14:08
Interfaces and Assertions: A Benchmark
/*
This is a very casual look at the speeds of type assertions:
Baseline returns what is passed in
Greeter returns a Person asserted from a Greeter interface
Empty returns a Person asserted from an empty interface
If you are a Rubyist, like myself, ~100ns per op is delightful. If you are used to real programming,
@pricees
pricees / more_on_go_interfaces.go
Last active August 29, 2015 14:08
Go interfaces, more
/*
Go Interface method sets can contain any number of exported and unported method signatures
Go Interfaces do no acknowledge the use of fields, and thus file you are free to use them, under the hood, you cannot call them on the Interface
*/
package main
import "fmt"
@pricees
pricees / gist:6c489293ef521b3a6b2c
Created November 6, 2014 06:42
hellosign coordinates
home_coords = {
buyers:[
[
[195, 825, :initials], # page 1 buyer 1
[200, (900 + 805), :initials], # page 2 buyer 1
[225, (1800 + 75), :signature], # page 3 buyer 1 sig
[200, (1800 + 785), :initials], # page 3 buyer 1
[200, (2700 + 785), :initials], # page 4 buyer 1
],
[
@pricees
pricees / neural_networks.go
Created November 7, 2014 22:50
Neural Networks in Go... will be back to finish this up.
package main
import (
"fmt"
"bytes"
"math"
"strconv"
)
@pricees
pricees / ruby_queues_are_essentially_go_channels.rb
Last active August 29, 2015 14:09
Ruby Queue/SizedQueue are essentially Go channels, who knew?
#
# Apparently this has been in Ruby since 1.9.3... who knew?
# Also check out sized queue class
#
require 'thread'
#
# Create a new thread that blocks on queue pop
# Create an "exit" channel to send "stop" message when total of 100 is reached
#