Skip to content

Instantly share code, notes, and snippets.

View mindscratch's full-sized avatar

Craig Wickesser mindscratch

View GitHub Profile
@mindscratch
mindscratch / good_ice_creams.scala
Created July 11, 2013 23:40
A nice example of using for/yield in Scala, copied from Learning Functional Programming without Growing a Neckbeard (http://www.youtube.com/watch?v=OOvL6QAxRK4)
def goodPairings(pies: List[Pie], iceCreams: List[IceCream]): List(Serving[Pie, IceCream]) {
for {
p <- pies
i <- iceCreams
var serving = new Serving(p, i)
if (serving.isGood)
} yield {
serving
}
}
@mindscratch
mindscratch / word_count.go
Created September 14, 2013 01:10
Using Go - count the number of times each word appears in a given string
package main
import (
"fmt"
"strings"
)
func WordCount(s string) map[string]int {
words := strings.Fields(s)
counts := make(map[string](int))
@mindscratch
mindscratch / _readme.md
Created September 26, 2013 12:15 — forked from shime/_readme.md

Having trouble installing the latest stable version of tmux?

Save yourself some time and run this little fellow!

Prerequisities

  • gcc
  • wget
@mindscratch
mindscratch / foo.go
Created December 7, 2013 04:18
go using underscores in front of import package names
// $GOPATH/src/foo/foo.go
package foo
import "fmt"
func init() {
fmt.Println("foo init")
}
func init() {
@mindscratch
mindscratch / notes.md
Last active December 17, 2021 18:01
functional programming notes
@mindscratch
mindscratch / server.go
Created January 20, 2014 18:24
TLS enabled HTTP Server in Go
package main
import (
"crypto/tls"
"fmt"
"log"
"net"
"net/http"
)
@mindscratch
mindscratch / .gitconfig
Created February 25, 2014 11:56
git config
[core]
editor = vim
[diff]
tool = kompare
[difftool]
prompt = false
[color]
ui = true
branch = auto
diff = auto
@mindscratch
mindscratch / check_env
Created February 26, 2014 10:28
script to check for environment variables
#!/usr/bin/env bash
. /etc/init.d/functions
declare -a env_variables=(FOO BAR)
function checkVariables {
for var in "${env_variables[@]}"
do
if env | grep -q ^"$var="
@mindscratch
mindscratch / learning_scala.md
Created March 7, 2014 11:36
learning scala

march 6, 2014

What's the difference between val and var?

  • A val variable can not have it's value changed, but a var variable can.

march 7, 2014

What's the deal with implicit val?

Keybase proof

I hereby claim:

  • I am mindscratch on github.
  • I am mindscratch (https://keybase.io/mindscratch) on keybase.
  • I have a public key whose fingerprint is 8AB1 4B40 90B4 C5EA 29D8 E3C9 5545 54A2 55F8 9F6E

To claim this, I am signing this object: