Skip to content

Instantly share code, notes, and snippets.

View dyross's full-sized avatar

David Y. Ross dyross

View GitHub Profile
@dyross
dyross / mauitips.md
Created October 26, 2012 17:51
some maui tips

Food

Maui Chocolates - best mochi on the island Costco - super cheap / fresh sashimi and poke Koiso - expensive sushi, slightly overrated Foodland (if you're in Kihei) - spam musubi, groceries Kihei Caffe - best breakfast place in town. Look out for Bunny, her sons run the restaurant these days, but she's a sweet woman who loves to walk around and share her life story.

== Places ==

@dyross
dyross / futureBad.scala
Created October 2, 2012 03:05
Scaling the Klout API with Scala, Akka, and Play
def blockingAndVerbose: Profile = {
val futureName = name()
val futureScore = score()
val futureFriends = Friends()
val nameResult = Await.result(futureName, 10 seconds)
val scoreResult = Await.result(futureScore, 10 seconds)
val friendsResult = Await.result(futureFriends, 10 seconds)
Profile(nameResult, scoreResult, friendsResult)
@dyross
dyross / Shelves.scala
Created September 26, 2012 20:58 — forked from feliperazeek/Shelves
ZooKeeper wrapper written in Scala
package com.klout.playful2.zookeeper
import com.twitter.zookeeper.ZooKeeperClient
import org.apache.zookeeper.CreateMode
import com.klout.playful2.sugar.{ config, please }
/**
* This is a simple library to add, set, delete and watch ZooKeeper nodes
*
* @author Felipe Oliveira [@_felipera]
package com.klout.api.services
import akka.agent.Agent
import akka.dispatch._
import org.joda.time._
import com.klout.playful2.sugar._
import com.klout.playful2.zookeeper._
import com.klout.playful2.actors._
import java.util.{ Map => javaMap }
import java.{ lang => java }
@dyross
dyross / .ctags
Created September 2, 2012 21:46
Scala CTags config
--langdef=Scala
--langmap=Scala:.scala
--regex-Scala=/[ \t]*class[ \t]*([a-zA-Z0-9_]+)/\1/c,classes/
--regex-Scala=/[ \t]*object[ \t]*([a-zA-Z0-9_]+)/\1/o,objects/
--regex-Scala=/[ \t]*trait[ \t]*([a-zA-Z0-9_]+)/\1/t,traits/
--regex-Scala=/[ \t]*type[ \t]*([a-zA-Z0-9_]+)/\1/T,types/
--regex-Scala=/[ \t]*def[ \t]*([a-zA-Z0-9_=]+)[ \t]*.*/\1/m,methods/
--regex-Scala=/[ \t]*val[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\1/V,values/
--regex-Scala=/[ \t]*val[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\1/V,values/
--regex-Scala=/[ \t]*var[ \t]*([a-zA-Z0-9_]+)[ \t]*[:=]/\1/v,variables/
@dyross
dyross / play-2.0-cake.scala
Created March 19, 2012 22:35
Using cake pattern in Play 2.0
// my response to https://groups.google.com/forum/?fromgroups#!searchin/play-framework/cake/play-framework/LQ2y40QNZaE/qvRFw5of-rQJ
import play.api._
import play.api.mvc._
// Domain object
case class User(id: String, name: String)
// Trait defining the service component
trait UserServiceComponent {
@dyross
dyross / config.scala
Created January 12, 2012 22:54
Scala DSL for loading properties in Play!
// Loading properties with Java API's is annoying...
// val someInt = play.configuration("some.int", 10).toInt
// val someBool = "true" == play.configuration("some.boolean", "true").toLowerCase
// This makes it nicer. It's specifically for play but can be easily changed.
object config {
def string(name: String): Proption[String] = {
Proption(Option(play.configuration(name)), name)