⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((root, Library)-> | |
if typeof! define is \Function && typeof! define[\amd] is "Object" && define[\amd]? | |
define <[ exports ]>, Library | |
else | |
Library = Library(typeof exports is "object" and exports or (root["Library"] = do | |
noConflict: ((original) -> | |
noConflict = -> | |
root["Libraby"] = original | |
delete! Library.noConflict | |
Library |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAIN_GOPATH=/usr/local/Cellar/go/1.2/workspace | |
export GOPATH=$MAIN_GOPATH | |
MAIN_PATH=$PATH:$GOPATH/bin | |
export PATH=$MAIN_PATH | |
# goenv functions | |
activate(){ | |
export GOPATH="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd)" | |
export OLDPS1=$PS1 | |
export PS1="(go:$(basename $GOPATH)) $PS1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Sample script to make an HTTP request with query parameters | |
local response = http.request { | |
url = 'http://www.random.org/integers/', | |
params = { | |
num=1, min=0, max=1, format='plain', | |
rnd='new', col=1, base=10 | |
} | |
} | |
if tonumber(response.content) == 0 then | |
return 'heads' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = app || { | |
id: "unique application instance id", | |
session_id: "unique session id", | |
render: function(){ | |
console.log("%c %s","font-size: 50px;color:yellow;", | |
"chat changed!"); | |
console.table(chat); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
rm go-swarm.test || true | |
nohup go test -c -gcflags '-N -l' -work github.com/olebedev/go-swarm | |
WORK=$(cat nohup.out) | |
rm nohup.out | |
cgdb go-swarm.test -- -d ${WORK#WORK=} || rm go-swarm.test || true | |
# gdb --tui go-swarm.test -d ${WORK#WORK=} || rm go-swarm.test || true | |
rm go-swarm.test || true | |
echo ${WORK#WORK=} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PID = /tmp/awesome-golang-project.pid | |
GO_FILES = $(wildcard *.go) | |
serve: | |
@make restart | |
@fswatch -o . | xargs -n1 -I{} make restart || make kill | |
kill: | |
@kill `cat $(PID)` || true |
It is possible to compile Go programs for a different OS, even though go build
says otherwise.
You'll need:
- a valid toolchain for the platform/os you're targetting
- Go Tip (works on 1.1 and 1.2rc1 but you might as well be on tip)
golang-crosscompile
helper script https://github.com/davecheney/golang-crosscompile- the patch provided
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"net" | |
"net/mail" | |
"net/smtp" | |
"crypto/tls" | |
) |
Setting up Dokku with DigitalOcean and Namecheap
..or how I made my own heroku in a few hours for $3.98.
This write-up owes a great deal to dscape's Node.js Deployments with Docker, Dokku, & Digital Ocean, the dokku project itself, and the fine folks working on dokku's issues. I took dscape's article as a starting point when trying this out but found some details lacking so I documented my own process for getting dokku up and running.
OlderNewer