Skip to content

Instantly share code, notes, and snippets.

I took a break from open source. Email if something critical needs to be merged.

JBD rakyll

I took a break from open source. Email if something critical needs to be merged.
Block or report user

Report or block rakyll

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:9d6d8b7aa7a3b05b7eba
"projection": [],
"kinds": [{
"name": "Company"
"filter": {
"compositeFilter": {
"filters": [{
"propertyFilter": {
"property": {
View gist:3b1cb2bfb46119c773b7
conf, err := google.NewServiceAccountJSONConfig(
if err != nil {
b := storage.New(conf.NewTransport()).Bucket("bamboo-shift-504")
b.Copy("filename1", &storage.ObjectInfo{
Bucket: "another-bucket",
rakyll / gist:5521097
Created May 5, 2013
Ugly but AppdataPreferencesSyncer is a singleton.
View gist:5521097
AppdataPreferencesSyncer syncer =
View _design-rate.json
"_id": "_design/rate",
"_rev": "57-8b50b18751ef1f968628606142c84e27",
"language": "javascript",
"views": {
"five_minutes": {
"map": "function(doc) {\n var date = new Date(doc.createdAt).toISOString();\n var key = date.substr(0, 15);\n \n key += (parseInt(date.substr(15,1), 10) < 5) ? '0' : '5';\n emit([key + \":00Z\", doc.tag], 1);\n}",
"reduce": "function(keys, values) {\n return sum(values);\n}"
View _design-tags.json
"_id": "_design/tags",
"_rev": "70-302fb6b6b2181d491b4cc75a6c0c29b5",
"language": "javascript",
"views": {
"relations": {
"map": "function(doc) {\n var mainTag = doc.tag.toLowerCase();\n var tags = doc.text.toLowerCase().split(' ').filter(function (word) {\n return word[0] === '#' && word !== mainTag;\n });\n\n tags.forEach(function(tag) {\n emit(mainTag, tag);\n });\n}",
"reduce": "function(keys, values, rereduce) {\n var mapping = {};\n \n if (rereduce) {\n values.forEach(function (val) {\n for (var tag in val)\n mapping[tag] = (mapping[tag] || 0) + val[tag];\n });\n } else {\n values.forEach(function (val) {\n mapping[val] = (mapping[val] || 0) + 1;\n });\n }\n \n return mapping;\n}"
"relations_recent": {
You need to run tests with:
go test -tags=test
View main.go
$ go run main.go
fatal error: concurrent map writes
goroutine 34 [running]:
runtime.throw(0x89200, 0x15)
/Users/jbd/go/src/runtime/panic.go:530 +0x90 fp=0xc8200806d8 sp=0xc8200806c0
runtime.mapassign1(0x5e940, 0xc8200161e0, 0xc8200807a0, 0xc8200807a0)
/Users/jbd/go/src/runtime/hashmap.go:445 +0xb1 fp=0xc820080780 sp=0xc8200806d8
main.main.func1(0xc8200161e0, 0xc82000a170)
/Users/jbd/src/ +0x50 fp=0xc8200807b0 sp=0xc820080780
rakyll / main.go
Created Jan 16, 2018
Go Spanner Client with OpenCensus
View main.go
// Copyright 2018 Google Inc. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
// Sample contains a simple program that
// uses Google Spanner Go client, and reports metrics
// and traces for the outgoing requests.
package main
import (
View gist:452e2e748a2a990ed5b8838861eafc12
s = status --short --branch --ignore-submodules=untracked
find = log --pretty=\"format:%Cgreen%H\n%s\n\n%b\" --name-status --grep
amend = commit --amend --no-edit
undo = reset HEAD~
upload = "!git push rakyll $(git rev-parse --abbrev-ref HEAD)"
prune = "!git co master && git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"
delete = branch -D
pr = "!git fetch origin pull/$1/head:pr$1"
sync = "!git pull -q -r origin master"
View a.json
[ {"name": "GET /", "ph": "X", "ts": 123, "dur": 234, "pid": 2343, "tid": 2347,
"args": {
"first": 1,
"": "",
"http.path": "/"
} },
You can’t perform that action at this time.