Skip to content

Instantly share code, notes, and snippets.

songgao /
Last active Feb 23, 2016
Shell functions for quickly `cd` into Go packages' source directories
gprefresh() {
go list -f "{{.Dir}}" ... 2>/dev/null > $GOPATH/.list;
_gpcd() {
if [ "$#" -eq 1 ]; then
cd $1
select p in $@; do
_gpcd $p
unset p

Keybase proof

I hereby claim:

  • I am songgao on github.
  • I am songgao ( on keybase.
  • I have a public key whose fingerprint is 018C 2285 4633 8910 B9C4 DC19 F18B E915 09E1 F508

To claim this, I am signing this object:

View Benchmark Max Function.go
Benchmarking against different approaches to calculate Max() of int.
* Patented (WTF?!) Abs used.
slice size: 1
min_with_branching: 200000000 9.28 ns/op
View TUN example in Go
package main
import (
songgao / gist:3185894
Created Jul 27, 2012
How to enable Gmail notification for Safari 6 in Mountain Lion
View gist:3185894

How to enable Gmail notification for Safari 6 in Mountain Lion

If you're like me who uses Safari, and finds Gmail in browser most comfortable to use, you might want to enable notification from Gmail in Safari 6. Notification Center in Mountain Lion does support websites in Safari to send notifications, but by now Gmail does not ask for permission to send notifications. Fortunately Gmail uses html5 notification, which is supported in Safari 6. We can manually request permission from Safari for Gmail.

  1. Enable Develop menu. Safari->Preferences->Advanced: Check "Show Develop menu in menu bar".
  2. Open
  3. Develop->Show Web Inspector. The console will show at bottom. Paste in following command in the console and press Enter. [1] window.webkitNotifications.requestPermission(function(){alert(window.webkitNotifications.checkPermission());})
  4. If the alert box shows 0, it means successfully gets notification permission. Send yourself an email with a different email addre
You can’t perform that action at this time.