Skip to content

Instantly share code, notes, and snippets.

@bmizerany
bmizerany / use.js
Last active December 17, 2015 19:19
function ajax(m, url) {
var r = new XMLHttpRequest();
r.open(m, url);
r.header = r.setRequestHeader;
r.basicAuth = function() {
var s = Array.prototype.slice.call(arguments).join(":");
r.header("Authorization", "Basic " + btoa(s));
}
@bmizerany
bmizerany / word.md
Created December 11, 2012 22:02
What Brian is doing today.

YOU'RE GOING CLIMBING!

@bmizerany
bmizerany / bench_test.go
Created October 23, 2012 19:05
benchmark repro for empty memprofile output
// On an ubuntu VM run as:
// GOGC=off ./benchtest.test -test.memprofile=mem.prof -test.run=none -test.bench=. -test.memprofilerate=1
// This will produce a 4k mem.prof with no information in it:
// $ go tool pproof ./benchtest.test mem.prof
// (prof) top10
// Total: 0.0 MB
package benchtest
import (
func progress(permission, play, pause chan bool) {
for {
select {
case <-pause:
<-play
default:
permission <- true
}
}
}
@bmizerany
bmizerany / gist:1557817
Created January 4, 2012 00:48
Clueless Recruiter
From: Matthew Greenburg <mgreenburg@astreya.com>
CC: Carl Narcisse <cnarcisse@astreya.com>
Blake,
My name is Matt Greenburg with Astreya Partners, an IT staffing company in Santa Clara. We bring on full time employees of Astreya to work on-site at our clients' locations. I came across your resume and was wondering if you were entertaining new career opportunities at this time. I think you would be a great fit for a position we have open as a Web Application Developer, Ruby on Rails.This position is located in Cupertino, CA at a large very well known company. Think big!
Web Application Developer, Ruby on Rails
Successful team members must be able to document, design, develop, validate and maintain complete solutions to specific business needs with minimal supervisory input in a dynamic, result driven environment. These contributors need a wide variety and depth of web-related (including associated back end) technical skills and are well organized, self-motivated people with excellent communication skills
@bmizerany
bmizerany / output.txt
Created December 12, 2011 22:09
Experimenting with Go's encoding/xml package.
--- FAIL: aws.TestUnmarshalError (0.01 seconds)
/Users/blake/src/aws.go/aws_test.go:55
! "AuthFailure" != ""
@bmizerany
bmizerany / console.log
Created October 31, 2011 19:42
The console commands + output
; gotest -x -v -cpuprofile=prof.out -run="no tests" -bench="."
gotest 0.00s: gomake testpackage-clean
rm -f _test/github.com/bmizerany/mc.go.a
[+0.08s]
gotest 0.08s: gomake testpackage GOTESTFILES=bench_test.go mc_test.go util_test.go
6g -p github.com/bmizerany/mc.go -o _gotest_.6 mc.go bench_test.go mc_test.go util_test.go
rm -f _test/github.com/bmizerany/mc.go.a
gopack grc _test/github.com/bmizerany/mc.go.a _gotest_.6
[+0.19s]
gotest 0.27s: gomake -s importpath
00000000 00 00 00 14 ....
00000004 00 03 00 00 75 73 65 72 00 62 6c 61 6b 65 00 00 ....user .blake..
00000000 52 00 00 00 08 00 00 00 00 53 00 00 00 16 61 70 R....... .S....ap
00000010 70 6c 69 63 61 74 69 6f 6e 5f 6e 61 6d 65 00 00 plicatio n_name..
00000020 53 00 00 00 19 63 6c 69 65 6e 74 5f 65 6e 63 6f S....cli ent_enco
00000030 64 69 6e 67 00 55 54 46 38 00 53 00 00 00 17 44 ding.UTF 8.S....D
00000040 61 74 65 53 74 79 6c 65 00 49 53 4f 2c 20 4d 44 ateStyle .ISO, MD
00000050 59 00 53 00 00 00 19 69 6e 74 65 67 65 72 5f 64 Y.S....i nteger_d
00000060 61 74 65 74 69 6d 65 73 00 6f 6e 00 53 00 00 00 atetimes .on.S...
00000070 1b 49 6e 74 65 72 76 61 6c 53 74 79 6c 65 00 70 .Interva lStyle.p
; gomake test
cd proto && gomake test
make install && cd testdata && make nuke && make
make[2]: Nothing to be done for `install'.
rm -rf *.o *.a *.[568vq] [568vq].out *.so _obj _test _testmain.go *.exe _cgo* test.out build.out test.pb.go
rm -f /Users/blake/src/go/pkg/darwin_amd64/test_proto.a
protoc --go_out=. test.proto
6g -o _go_.6 test.pb.go
rm -f _obj/test_proto.a
gopack grc _obj/test_proto.a _go_.6
@bmizerany
bmizerany / doozer_lock.rb
Created August 28, 2011 21:39 — forked from therealadam/doozer_lock.rb
Locking with Doozer
require 'rubygems'
require 'fraggle/block'
# # Locks with doozerd
#
# Doozerd is a little coordination service. I think of it like Zookeeper
# Lite (TM). In today's episode, we'll naively manage exclusive advisory locks.
#
# Disclaimer: If part of this implementation is total lolscale,
# please to let me know what papers/sources I should read to avoid lolscaling.