Skip to content

Instantly share code, notes, and snippets.

View btc's full-sized avatar
🍃

brian tiger chow btc

🍃
View GitHub Profile
@btc
btc / observer_example.c
Created January 30, 2014 06:56
Observers in C
/* observed component */
typedef struct
{
int listener_count;
/* array of function pointers */
void (*listener_list[10])(unsigned,unsigned);
} Button;
void button_Init( Button *pButton )
{
@btc
btc / waltz.go
Last active August 29, 2015 13:57
A Beautiful Dance: Synchronous Channels in Go
// what a beautiful application of synchronous channels!
// source: https://blog.mozilla.org/services/2014/03/12/sane-concurrency-with-go/
type Account struct {
balance float64
deltaChan chan float64
balanceChan chan float64
errChan chan error
}
NAME(s)
Brian Holder-Chow Lin On (brianhc)
Nick Hewitt (nhewitt)
DESIGN
======
Overview:
We decided to use an explicit free list in the form of a hash table of linked
lists.
A <- B <- C <- D <- E (master)
A <- B <- C (master)
A <- B <- C <- F <- G (feature)
rebase:
A <- B <- C <- D <- E <- F <- G (feature)
@btc
btc / -
Created July 6, 2014 23:44
SELECT targets.id, targets.name, traits.id, traits.name
FROM Traits INNER JOIN People AS targets ON
targets.id != me
LEFT OUTER JOIN Opinions AS ops ON
ops.person_id = me AND
ops.trait_id = traits.id AND
ops.about_id = targets.id
GROUP BY targets.id, traits.id
HAVING(MAX(ops.update_at)
WHERE ops.rating IS NULL
#homebrew before usr/bin
export PATH=/usr/local/bin:$PATH
# to load up z index
. $HOME/bin/z.sh
# appending to PATH
PATH=$HOME/bin:$PATH
# for virtualenvwrapper
@btc
btc / -
Created September 30, 2014 20:33
### Keybase proof
I hereby claim:
* I am perfmode on github.
* I am btc (https://keybase.io/btc) on keybase.
* I have a public key whose fingerprint is 0718 9EE5 4558 D12C 0F5E DAF9 4A80 1C5D 01C0 09DE
To claim this, I am signing this object:
package blockservice
import (
"bytes"
"testing"
"time"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
dssync "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
@btc
btc / -
Created November 29, 2014 01:18
684adf9b746beb167df20147c5f79f84
@btc
btc / -
Created November 29, 2014 01:19
d6f6b0c279d7f50f741a8d01509959dc