Skip to content

Instantly share code, notes, and snippets.

@quii
quii / channel.go
Created April 7, 2015 16:20
Simple golang channel example
package main
import (
"fmt"
)
type Baz struct {
Y string
}
package main
import (
"fmt"
"net/http"
)
type CoPublisher struct {
id string
link string
@quii
quii / composition.clj
Created July 24, 2015 13:14
Function composition in Clojure
foo=> (defn x [a] (+ a 1))
#'foo/x
foo=> (defn y [a] (+ a 2))
#'foo/y
foo=> (-> 5 x y)
8
foo=> (defn z [a] (-> a x y))
#'foo/z
foo=> (z 10)
13
@quii
quii / clojure.clj
Last active August 29, 2015 14:26
My notes on learning some clojure
(comment
Clojure notes. Gathered from links below and "Programming Clojure"
- Uniform syntax.
- Code is data
- Immutablility encouraged
- [http://learnxinyminutes.com/docs/clojure/]
- [http://www.4clojure.com/problem/8#prob-title]
- [http://www.braveclojure.com/]
- Revenge of the nerds http://www.paulgraham.com/icad.html
(def counter (atom 0))
(defn click-counter [] [:input {:type "button" :value "clicky" :on-click #(swap! counter inc)}])
(defn home-page []
[:div [:h1 "Counter " @counter] [click-counter]])
@quii
quii / The Technical Interview Cheat Sheet.md
Last active August 29, 2015 14:28 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
package overpoker.web
import org.http4s.server._
import org.http4s.dsl._
trait HelloService{
def sayHello(name: String): String
}
object RealHelloService extends HelloService{
func TestAddition(t *testing.T){
x := getRandomInt()
y := getRandomInt()
expected := x + y
if expected != add(x, y){
// oh no..
}
func TestComplicatedThing(t *testing.T){
x := getRandomInt()
y := getRandomInt()
expected := complicated(x, y)
if expected != complicated(x, y){
// oh no..
}
}
func TestAddingZeroMakesNoDifference(t *testing.T) {
/*
Create an assertion, which is a function that takes N inputs of
random data and returns true if the assertion passes.
In this case, we're saying take any random integer (x)
If you add 0, it should equal x
*/
assertion := func(x int) bool {
return add(x, 0) == x