Skip to content

Instantly share code, notes, and snippets.

View gideondk's full-sized avatar

Gideon de Kok gideondk

View GitHub Profile
### Keybase proof
I hereby claim:
* I am gideondk on github.
* I am gideondk (https://keybase.io/gideondk) on keybase.
* I have a public key ASDIiagzD_sJA9f7HYXNcFreVLjpGZYpEUmf5qh3NHN2IQo
To claim this, I am signing this object:
@gideondk
gideondk / keybase.md
Last active August 29, 2015 13:59
keybase.md

Keybase proof

I hereby claim:

  • I am gideondk on github.
  • I am gideondk (https://keybase.io/gideondk) on keybase.
  • I have a public key whose fingerprint is 1C24 1663 3E5C AC08 5342 58CA 490A 3844 7DC9 4021

To claim this, I am signing this object:

/* Null based */
def fetchUser(userId: String): User = db.user.fetch(userId)
def fetchOrganization(organizationId: String): Organization = db.organization.fetch(organizationId)
def fetchCase(caseId: String): Case = db.case.fetch(caseId)
def fetchCasesForUser(userId: String): List[Case] = {
val user = fetchUser(userId)
if (user != null) {
val organization = fetchOrganization(user)
if (organization != null) {
import scalaz._
import Scalaz._
import akka.actor.IO._
object IterateeZMonad {
implicit def iterateeZMonad[A] = new Monad[Iteratee] {
override def map[A, B](fa: Iteratee[A])(f: A ⇒ B): Iteratee[B] = fa map f
@gideondk
gideondk / stringit.rb
Created October 29, 2012 19:57 — forked from srpouyet/stringit.rb
Functional programming babysteps :) Code reduction ;-)
# Functional programming babysteps :)
# This Proc returns a "stringified" version of the object you passed it.
# Example:
#
# h = Hash[1,2,3,4,5,[8,9,{:age => 90},[[[[60,{"a" => "gho"}]]],{[:what, 0] => [4.0 => 88.7]}]]]4.0 => 88.7]}]]]
# => {1=>2, 3=>4, 5=>[8, 9, {:age=>90}, [[[[60, {"a"=>"gho"}]]], {[:what, 0]=>[{4.0=>88.7}]}]]}
# stringit[h]
#=> {"1"=>"2", "3"=>"4", "5"=> ["8","9",{"age"=>"90"},[[[["60", {"a"=>"gho"}]]], {["what", "0"]=>[{"4.0"=>"88.7"}]}]]}
stringit = Proc.new do |v|
val clientPool = new ScaliakPbClientPool("127.0.0.1", 8087, 8098)
val clientPool = new ScaliakPbClientPool("127.0.0.1", 8087, 8098)
val client = Scaliak.pbClient("127.0.0.1", 8087, 8098)
object Photo extends DomainObjectWrapper[Photo](classOf[Photo])
MapReducePhasePipe(mapValuesToJson(false) |- sort(field, sortDESC))