This file contains hidden or 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
| #include <SPI.h> | |
| #include <Ethernet.h> | |
| #include <dht11.h> | |
| dht11 DHT11 = dht11(D1, BUSA) | |
| byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; | |
| EthernetServer server(80); | |
| void setup() { | |
| delay(1000); |
This file contains hidden or 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
| play.core.ActionInvoker$$anonfun$receive$1$$anon$1: Execution exception [[NullPointerException: null]] | |
| at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:134) [play_2.9.1.jar:2.0.2] | |
| at play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:115) [play_2.9.1.jar:2.0.2] | |
| at akka.actor.Actor$class.apply(Actor.scala:318) [akka-actor.jar:2.0.2] | |
| at play.core.ActionInvoker.apply(Invoker.scala:113) [play_2.9.1.jar:2.0.2] | |
| at akka.actor.ActorCell.invoke(ActorCell.scala:626) [akka-actor.jar:2.0.2] | |
| at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:197) [akka-actor.jar:2.0.2] | |
| Caused by: java.lang.NullPointerException: null | |
| at java.io.Reader.<init>(Reader.java:61) ~[na:1.6.0_33] | |
| at java.io.InputStreamReader.<init>(InputStreamReader.java:55) ~[na:1.6.0_33] |
This file contains hidden or 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.libs.oauth._ | |
| import play.api.libs.ws.WS | |
| object Application extends Controller { | |
| object MyApi { |
This file contains hidden or 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 CachedWS { | |
| def apply[T](key: String)(f: => Promise[Option[T]])(implicit m: scala.reflect.ClassManifest[T]): Promise[Option[T]] = | |
| Cache.getAs[T](key).map(t => Promise.pure(Some(t))).getOrElse{f.map(_.map{ t => Cache.set(key, t); t})} | |
| } |
This file contains hidden or 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 demo | |
| package ids { | |
| import record.Id | |
| object FooId extends Id[Int] | |
| object BarId extends Id[Int] | |
| object BazId extends Id[String] | |
| } | |
| package foomodel { |
This file contains hidden or 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
| #!/usr/bin/env python | |
| import sys, os, json | |
| from rdioapi import Rdio | |
| from collections import defaultdict | |
| config_path = os.path.expanduser('~/.rdio-tool.json') | |
| if os.path.exists(config_path): | |
| config = json.load(file(config_path)) | |
| else: |
This file contains hidden or 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
| // goal: define one method which can be given arguments of different types (i.e. without a common supertype) | |
| // lift (diaf) uses setFromAny(arg: Any) and a match, but in doing so loses typesafety. | |
| case class Foo(i: Int) | |
| case class Bar(v: String) | |
| case class Baz(d: Boolean) | |
| val foo = Foo(1) | |
| val bar = Bar("1") | |
| val baz = Baz(false) |
This file contains hidden or 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
| <!doctype html> | |
| <html> | |
| <head> | |
| <title></title> | |
| <style> | |
| body { | |
| background: white; | |
| text-align: center; | |
| padding: 20px; | |
| font-family: Georgia, serif; |
This file contains hidden or 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
| trait Finder[RecordType] { | |
| def findAll(ids: Seq[Long]): Seq[RecordType] = Nil | |
| def find(id: Long): Option[RecordType] = None | |
| } | |
| abstract class Bar { def id: Long } ; object Bar extends Finder[Bar] | |
| abstract class Baz { def id: Long } ; object Baz extends Finder[Baz] | |
| abstract class Foo { | |
| def id: Long | |
| def barId: Long // this could be here as a MongoForeignObjectId thanks to a Bar.FK trait too | |
| def bazId: Long |
This file contains hidden or 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 demo | |
| trait Bar | |
| abstract class Foo[T] {} | |
| object Foo { | |
| implicit def FooFromBar[T <: Bar : Manifest]: Foo[T] = new Foo[T] { } | |
| def apply[T : Foo] = implicitly[Foo[T]] | |
| def baz[T : Foo](arg: T): Unit = { println("ha!")} | |
| } |