Skip to content

Instantly share code, notes, and snippets.

@caelifer
caelifer / grid.go
Last active September 29, 2015 18:09
package main
import (
"errors"
"fmt"
"time"
)
type Grid struct {
height, width int
@caelifer
caelifer / jitter.go
Last active September 29, 2015 17:57
package main
import (
"fmt"
"math/rand"
"time"
)
type Factor struct {
num, denom uint32
package main
// Exersice #1 from http://whipperstacker.com/2015/10/05/3-trivial-concurrency-exercises-for-the-confused-newbie-gopher/
import (
"fmt"
"math/rand"
"sync"
"time"
)
package main
import (
"log"
"os"
"os/exec"
"syscall"
"time"
)
package main
import (
"encoding/base64"
"fmt"
)
type User struct {
name, pass string
}
// Taken from https://github.com/mdempsky/maligned/blob/master/maligned.go#L227.
// Corrected for the negative x.
// align returns the smallest y >= x such that y % a == 0.
func align(x, a int64) int64 {
sign := int64(1)
if x < 0 {
x = -x
sign = -1
}
package main
import (
"fmt"
)
func IsLeapYear(y int) bool {
return y%4 == 0 && y%100 != 0 || y%400 == 0
}
@caelifer
caelifer / .vimrc
Created October 20, 2015 22:41
Minimal VIM resource file with nice colorscheme
" Install additional plugins
execute pathogen#infect()
" Basic configs
syntax on
filetype plugin indent on
set nu
hi CursorLine cterm=bold ctermbg=233
set cursorline
package main
import (
"fmt"
"strconv"
"strings"
)
type ProblemCounter int
package main
import (
"fmt"
"log"
"regexp"
"strings"
"time"
)