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
function debounce(a,b,c){var d;return function(){var e=this,f=arguments;clearTimeout(d),d=setTimeout(function(){d=null,c||a.apply(e,f)},b),c&&!d&&a.apply(e,f)}} |
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
for i in *.png; do sips -s format jpeg $i --out Converted/$i.jpg;done |
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 log follows linux output convention | |
// Top level functions like Test() and Verbose() set the package "mode" | |
package log | |
import ( | |
"io/ioutil" | |
"log" | |
"os" | |
) |
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 foo | |
import "os" | |
import "log" | |
// Level indicates Logger verbosity | |
type Level int | |
// LogLevel specifies the minimum level logged | |
var LogLevel = Debug |
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 ( | |
"go/parser" | |
"go/token" | |
"io" | |
"strings" | |
) | |
// APIDoc is an API Documentation generator. |
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
// An electronic mail address | |
type email struct { | |
s string | |
} | |
var invalidEmail = errors.New("invalid email") | |
func newEmail(s string) (email, error) { | |
s = strings.Trim(s, " ") |
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
#!/bin/bash | |
which entr > /dev/null | |
if [ $? -ne 0 ]; then | |
echo "installing entr" | |
brew install entr | |
else | |
echo "watching go files" | |
fi |
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 uuidFunc = uuidV4 // for swapping in test | |
func uuidV4() string { | |
b := make([]byte, 16) | |
_, err := io.ReadFull(rand.Reader, b) | |
if err != nil { | |
panic(err) | |
} | |
b[6] = (b[6] & 0x0F) | 0x40 | |
b[8] = (b[8] &^ 0x40) | 0x80 |
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 ( | |
"errors" | |
"fmt" | |
"time" | |
) | |
var realError = errors.New("real") | |
var timeoutError = errors.New("timeout") |
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
// set term png | |
// set xlabel 'Samples' | |
// set ylabel 'MB' | |
// set output 'name.png' | |
// plot | |
// "name.dat" using 1:($2/1e6) title 'Sys' with lines, | |
// "name.dat" using 1:($3/1e6) title 'Alloc' with lines, | |
// "name.dat" using 1:($4/1e6) title 'Idle' with lines | |
type chart struct { | |
filename string |
NewerOlder