This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
$(document).ready(function(){ | |
}); | |
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object AppCommon { | |
def using[A <% { def close(): Unit }, B](s: A)(f: A => B) = { | |
try { | |
f(s) | |
} catch { | |
case e: Exception => println(e.getStackTraceString) | |
} finally { | |
try { | |
s.close() | |
} catch { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object MD5 { | |
def apply(s: String): String = { | |
val m = java.security.MessageDigest.getInstance("MD5") | |
val b = s.getBytes("UTF-8") | |
m.update(b, 0, b.length) | |
new java.math.BigInteger(1, m.digest()).toString(16) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DynamicImpl(x: AnyRef) extends Dynamic { | |
def applyDynamic(name: String)(args: Any*) = { | |
new DynamicImpl(x.getClass.getMethod(name).invoke(x, | |
args.map(_.asInstanceOf[AnyRef]) : _*)) | |
} | |
def _select_(name: String): DynamicImpl = { | |
new DynamicImpl(x.getClass.getMethod(name).invoke(x)) | |
} | |
def _invoke_(name: String)(args: Any*) = { | |
new DynamicImpl(x.getClass.getMethod(name, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import play.api._ | |
import play.api.mvc._ | |
import play.api.data._ | |
import play.api.data.Forms._ | |
import models._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<classpath> | |
<classpathentry output="target/scala-2.9.1/classes" path="app" kind="src"></classpathentry> | |
<classpathentry output="target/scala-2.9.1/test-classes" path="test" kind="src"></classpathentry> | |
<classpathentry path="/Users/shanon/play-2.0.1/framework/sbt/boot/scala-2.9.1/lib/scala-library.jar" kind="lib"></classpathentry> | |
<classpathentry path="/Users/shanon/play-2.0.1/framework/../repository/local/play/play_2.9.1/2.0.1/jars/play_2.9.1.jar" kind="lib"></classpathentry> | |
<classpathentry path="/Users/shanon/play-2.0.1/framework/../repository/local/play/templates_2.9.1/2.0.1/jars/templates_2.9.1.jar" kind="lib"></classpathentry> | |
<classpathentry path="/Users/shanon/play-2.0.1/framework/../repository/local/com.github.scala-incubator.io/scala-io-file_2.9.1/0.2.0/jars/scala-io-file_2.9.1.jar" kind="lib"></classpathentry> | |
<classpathentry path="/Users/shanon/play-2.0.1/framework/../repository/local/com.github.scala-incubator.io/scala-io-core_2.9.1/0.2.0/jars/scala-io-core_2.9.1.jar" kind="lib"></cl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<classpath> | |
<classpathentry output="target/scala-2.9.1/classes" path="app" kind="src"></classpathentry> | |
<classpathentry output="target/scala-2.9.1/test-classes" path="test" kind="src"></classpathentry> | |
<classpathentry path="/Users/shanon/play-2.0.1/framework/sbt/boot/scala-2.9.1/lib/scala-library.jar" kind="lib"></classpathentry> | |
<classpathentry path="/Users/shanon/play-2.0.1/framework/../repository/local/play/play_2.9.1/2.0.1/jars/play_2.9.1.jar" kind="lib"></classpathentry> | |
<classpathentry path="/Users/shanon/play-2.0.1/framework/../repository/local/play/templates_2.9.1/2.0.1/jars/templates_2.9.1.jar" kind="lib"></classpathentry> | |
<classpathentry path="/Users/shanon/play-2.0.1/framework/../repository/local/com.github.scala-incubator.io/scala-io-file_2.9.1/0.2.0/jars/scala-io-file_2.9.1.jar" kind="lib"></classpathentry> | |
<classpathentry path="/Users/shanon/play-2.0.1/framework/../repository/local/com.github.scala-incubator.io/scala-io-core_2.9.1/0.2.0/jars/scala-io-core_2.9.1.jar" kind="lib"></cl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib import urlopen | |
import json | |
[len(x) for x in [json.loads(y) for y in urlopen('https://api.github.com/repos/playframework/play/pulls?state=open&per_page=100')]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.codahale.jerkson.Json._ | |
object toJson { | |
def apply[A<:Any](a: A) = { | |
val cls = a.getClass | |
val value = cls.getDeclaredFields.map(_.getName).map(x=>(x, cls.getDeclaredMethod(x).invoke(a))).toMap | |
generate(value) | |
} | |
} |
NewerOlder