Skip to content

Instantly share code, notes, and snippets.

package main
import "fmt"
func nextPermutation(x byte) byte {
a := x & -x
b := x + a
c := b ^ x
a <<= 2
c /= a
package main
import (
"log"
"math/rand"
"sync"
"time"
)
func init() {
@caelifer
caelifer / merger.go
Last active November 20, 2015 18:03
// Implementation of merge task from http://raganwald.com/2015/11/03/a-coding-problem.html
package main
import (
"fmt"
"sort"
)
func main() {
package main
import "fmt"
var bits [256]int
func init() {
for i := range bits {
bits[i] = bits[i>>1] + i&0x1
}
package main
import (
"fmt"
"math/rand"
"reflect"
"testing/quick"
)
type Point struct {
package main
import (
"fmt"
"sync"
)
func main() {
var wg sync.WaitGroup
cb := NewCB(5)
package main
import (
"fmt"
"log"
"regexp"
"strings"
"time"
)
package main
import (
"fmt"
"strconv"
"strings"
)
type ProblemCounter int
@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"
)
func IsLeapYear(y int) bool {
return y%4 == 0 && y%100 != 0 || y%400 == 0
}