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
/* e.g. <span data-datetime="1395760693000">2014-03-25 15:18:13</span> will be replaced with localized date/time on load */ | |
$("[data-datetime]").each(function () { | |
el = $(this); | |
el.text(new Date(parseInt(el.data("datetime"))).toLocaleString()); | |
}); | |
/* e.g. <span data-date="1395760693000">2014-03-25</span> */ | |
$("[data-date]").each(function () { | |
el = $(this); | |
el.text(new Date(parseInt(el.data("date"))).toLocaleDateString()); |
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
*[data-tooltip]::before | |
{ | |
box-shadow: .3em .3em .3em rgba(0, 0, 0, 0.4); | |
max-width: 30em; | |
font-size: 80%; | |
font-weight: normal; | |
background: #ff9; | |
color:#000; | |
border: 1pt solid #000; | |
padding: 0.5em; |
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 | |
# Usage: benchwc.sh "path/to/package" "-build flags" | |
# e.g. benchwc.sh ./mypkg "-cpu=1,2,4 -tags=debug -benchtime=2s" | |
DIR=${1:-.} | |
BFLAGS=$2 | |
git stash save || exit 1 | |
cd $DIR && go test -run=^$ -bench=. -benchmem $BFLAGS | tee old.out | |
git stash pop || exit 1 | |
cd $DIR && go test -run=^$ -bench=. -benchmem $BFLAGS | tee new.out | |
benchcmp old.out new.out | tee comparison.out |
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
# This file is intended as a starting point for a customized makefile for a Go project. | |
# | |
# Targets: | |
# all: Format, check, build, and test the code | |
# setup: Install build/test toolchain dependencies (e.g. gox) | |
# lint: Run linters against source code | |
# format: Format the source files | |
# build: Build the command(s) for target OS/arch combinations | |
# install: Install the command(s) | |
# clean: Clean the build/test artifacts |
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 config | |
import ( | |
"errors" | |
"io/ioutil" | |
"net/http" | |
"github.com/aws/aws-sdk-go/aws" | |
"github.com/aws/aws-sdk-go/aws/session" | |
"github.com/aws/aws-sdk-go/service/autoscaling" |
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
type Collator struct { | |
results chan interface{} | |
errors chan error | |
wg *sync.WaitGroup | |
} | |
func NewCollator() *Collator { | |
return &Collator{ | |
results: make(chan interface{}), | |
errors: make(chan error), |
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 password | |
import ( | |
"bytes" | |
"crypto/rand" | |
"crypto/sha256" | |
"fmt" | |
"bufio" | |
"errors" | |
"io" |
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 ( | |
"encoding/json" | |
"fmt" | |
"io" | |
"io/ioutil" | |
"log" | |
"os" | |
"time" |
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 | |
cmd=$1 | |
shift | |
env=$1 | |
shift | |
terraform workspace select $env || exit_error "failed to select workspace $env" | |
case $cmd in | |
# Custom command: plan -> outfile, confirm, apply outfile | |
planapply) |
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 | |
# Usage: | |
# mrclean - list kitchen instances in all cookbooks | |
# mrclean destroy - destroy kitchen instances in all cookbooks | |
# Update to your cookbook path | |
CBDIR=$HOME/chef-repo/cookbooks | |
for c in $CBDIR/*; do | |
echo $(basename $c) |
OlderNewer