This file contains hidden or 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
(function(exports) { | |
var mod = function (databaseName, saveInterval) { | |
var self; | |
saveInterval = saveInterval || 2000; | |
databaseName = databaseName || 'unnamed'; | |
this.hasChanged = false; | |
this.store = {}; |
This file contains hidden or 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
import datetime | |
now = datetime.now() | |
day_of_year = now.timetuple().tm_yday | |
current_hour_of_day = now.timetuple().tm_hour | |
hour_of_year = day_of_year * 24 - 24 + current_hour_of_day | |
This file contains hidden or 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
#!/bin/bash | |
export GOPATH=`pwd` | |
export PATH=$PATH:$GOPATH/bin | |
# in order to have the env variables set you need to run this script with 'source' or '.' instead of just 'bash' or './' |
This file contains hidden or 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
func jsonLoads(j string) map[string]interface{} { | |
sB := []byte(j) | |
var f interface{} | |
// At this point the Go value in f would be a map whose keys are strings and whose values are themselves stored as empty interface values: | |
// If the json is formated wrong, f will be nil :TODO catch that error | |
json.Unmarshal(sB, &f) | |
// To access this data we can use a type assertion to access `f`'s underlying map[string]interface{}: | |
m := f.(map[string]interface{}) | |
return m |
This file contains hidden or 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
#!/bin/bash | |
firefox google.com </dev/null &>/dev/null & | |
sleep 3 | |
firefox -new-tab mail.provplan.org </dev/null &>/dev/null | |
firefox -new-tab toggl.com </dev/null &>/dev/null | |
google-chrome gmail.com | |
google-chrome twitter.com |
This file contains hidden or 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" | |
import "strings" | |
import "strconv" | |
func main() { | |
fmt.Println("Hello, playground") | |
s := "1,2,4" | |
n := commaStringToIntSlice(s) |
This file contains hidden or 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" | |
import "reflect" | |
func main() { | |
a := []interface{}{1,3,4,5,"!@"} | |
dothis(a...) | |
} |
This file contains hidden or 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
echo 'flush_all' | nc localhost 11211 |
This file contains hidden or 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 ( | |
"encoding/csv" | |
"fmt" | |
"io" | |
"os" | |
) | |
// documentation for csv is at http://golang.org/pkg/encoding/csv/ |
This file contains hidden or 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
function f(){ | |
console.log(this) | |
} | |
// window scope | |
f() | |
// object scope | |
var o = { | |
'f':f |