Skip to content

Instantly share code, notes, and snippets.

View jaybill's full-sized avatar

Jaybill McCarthy jaybill

View GitHub Profile
@jaybill
jaybill / server.go
Created April 25, 2012 21:29
Trailing slash forces GET method on request?
package main
import(
"net/http"
"log"
"fmt"
)
func route(pattern string, fn func(*http.Request) string){
http.HandleFunc(pattern,makeHandler(fn))
@jaybill
jaybill / server.go
Created May 2, 2012 15:21
gorilla sessions issue
package main
import (
"net/http"
"code.google.com/p/gorilla/sessions"
"log"
)
var store = sessions.NewCookieStore([]byte("something-very-secret"))
@jaybill
jaybill / server.go
Created May 3, 2012 15:07
Type assertions on session values.
package main
import (
"encoding/gob"
"net/http"
"code.google.com/p/gorilla/sessions"
"log"
)
@jaybill
jaybill / copytree.go
Created June 5, 2012 17:46
How to copy a directory tree (preserving permissions) in Go.
package main
import "fmt"
import "os"
import "io"
import "io/ioutil"
import "log"
// Copies file source to destination dest.
func CopyFile(source string, dest string) (err error) {
rsync -avz /path/to/local/sync/folder -e "ssh -i /path/to/ssh/key" ubuntu@ec2instance:/path/to/remote/sync/folder
var f = "mailto:foo@bar";
if (f.substring(0,"mailto".length) == "mailto")
{
var email = f.substring( "mailto".length + 1, f.length);
console.log(email)
};
@jaybill
jaybill / Oat Bread
Last active August 29, 2015 13:57
Bread Recipes
1 cup Whole Wheat Bread Flour
2 cup AP Flour
3/4 cup Steel Cut Oats
2 1/4 cup water
1/4 tsp instant yeast
1 1/4 tsp salt
http://www.breadtopia.com/basic-no-knead-method/
@jaybill
jaybill / .bash_aliases
Created March 25, 2014 18:18
Git style ignoring for Subversion
# Use '_ss' instead of 'svn status' in the directory where your repo is
# version a file in the root of your repo called '.svnignore' that
# has one ignore pattern per line
alias _ss="svn status | egrep -v '`cat .svnignore|perl -p -e 's/\n/|/'`'"
# Other useful svn aliases
alias _sa="svn add"
alias _su="svn up"
alias _sc="svn ci --message
@jaybill
jaybill / gist:10752073
Created April 15, 2014 17:47
White Bread
3 cups flour
2 teaspoons salt
2 teaspoons yeast
1 1/8 cup water
@jaybill
jaybill / gist:10760010
Created April 15, 2014 19:02
Whole-ish Wheat Bread
2 cups AP flour
1 cup Whole Wheat flour
2 teaspoons salt
2 teaspoons yeast
1 1/8 cup water