Skip to content

Instantly share code, notes, and snippets.

View enahs's full-sized avatar
🥋
乱取り

Shane enahs

🥋
乱取り
  • Oakland, CA
View GitHub Profile
@enahs
enahs / nullstring.go
Last active January 4, 2022 23:52
A proper nullstring implementation in go. overrides database/sql nullstring, makes it marshal to json properly, doesn't respect omitempty struct tag but considers empty string valid. only downside is pointer based constructor function and accessing the value sucks.
package main
import (
"database/sql"
"encoding/json"
"fmt"
)
// make a json'able null string
// - doesn't respect omitempty
@enahs
enahs / Mimetype.go
Last active November 24, 2015 23:17
Mimetype - a simple, command line utility that uses go's http.DetectContentType to get the mimetype of a file.
package main
import (
"net/http"
"os"
)
const (
usage = `usage: mimetype [filename]`
)
@enahs
enahs / ll.go
Last active August 29, 2015 14:16
Go Linked List Example
package main
import "fmt"
type Node struct {
Data interface{}
Next *Node
}
type list struct {
@enahs
enahs / markdown.xml
Last active December 19, 2015 20:09 — forked from lg0/markdown.xml
Get Monokai to work right with markdown. paste this into /Users/[your user name here]/Library/Application Support/Sublime Text 2/Packages/Color Scheme - Default/[YOUR_THEME].tmTheme
<!-- copy this to YOUR_THEME.tmTheme-->
<dict>
<key>name</key>
<string>diff: deleted</string>
<key>scope</key>
<string>markup.deleted</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#EAE3CA</string>