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 IndentLines(indent, code string) string { | |
reader := bufio.NewReader(bytes.NewBufferString(code)) | |
buf := bytes.NewBufferString("") | |
line, prefix, err := reader.ReadLine() | |
for err == nil && line != nil { | |
if !prefix { | |
buf.WriteString(indent) | |
} |
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
type Db struct { | |
db *bolt.DB | |
err error | |
} | |
func (d *Db) start() *bolt.DB { | |
d.db, d.err = bolt.Open("my.db", 0600, nil) | |
if d.err != nil { | |
fmt.Println(d.err) | |
} |
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
colors = { | |
green: #38ab0b | |
red: #ab130b | |
blue: #099aab | |
} | |
for name, color in colors | |
.btn-{name} | |
background: mix(color, white, 60%) | |
&:hover |
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 | |
# Examples of Looping in Bash | |
tools=( git zsh emacs tmux mlocate open-vm-tools ) | |
for r in "${tools[@]}"; do | |
echo $r | |
done |
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 | |
function clean() { | |
rm -rf a b c | |
} | |
function _a() { | |
mkdir 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
package lookup | |
import "reflect" | |
type Lookup struct { | |
target interface{} | |
} | |
type Facet struct { | |
Method reflect.Method |
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 | |
function godoc_procs() { | |
ps -ef | grep 'godoc -http=:1212' | grep -v grep | cut -f 2 -d ' ' | |
} | |
function launch_godoc() { | |
procs=$(godoc_procs) | |
if [ "$procs" -gt 1 ]; then | |
godoc_procs | xargs kill -9 |
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
;;; go-template-mode.el --- Major mode for Go template language | |
;;; Commentary: | |
;; 1) Copy this file somewhere in your Emacs `load-path'. To see what | |
;; your `load-path' is, run inside emacs: C-h v load-path<RET> | |
;; | |
;; 2) Add the following to your .emacs file: | |
;; | |
;; (require 'go-template-mode) |
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
alt-, => cmd-, do not remapped modifier | |
al-1 => Unicode char ¡ so that in emacs I can bind cmd-1 to neotree-toggle | |
c-shift-b => M-f forward-word | |
c-shift-f => M-b backward-word | |
alt-b => C-b forward-char | |
alt-i => M-i other-window -1 | |
alt-o => M-o other-window +1 | |
alt-k => M-k kill-buffer | |
alt-tab => cmd-tab do not remap modifier |
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
## Fill in the areas with the [custom] label. | |
#user nobody; | |
worker_processes 1; | |
error_log [custom]/error.log; | |
events { | |
worker_connections 1024; | |
} |