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 json | |
import reactivemongo.bson._ | |
import reactivemongo.bson.handlers.DefaultBSONHandlers._ | |
import play.api.libs.json._ | |
import play.api.libs.json.Json._ | |
import play.api.libs.json.util._ | |
import play.api.libs.json.Writes._ | |
import play.api.libs.functional.syntax._ |
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
// Adding new functionality via inheritance leads to combinatorial explanation | |
abstract class Serializer { | |
def write(string: String): Unit | |
} | |
class CsvFileWriter extends FileWriter { | |
def writeFile(file: java.io.File) = //... | |
} |
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
# Separate functions | |
success = (data, status, header) -> | |
promise.resolve data.user | |
error = (data, status, header) -> | |
promise.reject data.error | |
user = getUserById id, success, error | |
# Comma in front of each function | |
user = getUserById id |
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
var toggleWatch = function(watchExpr, fn) { | |
var watchFn; | |
return function() { | |
if (watchFn) { | |
watchFn(); | |
watchFn = undefined; | |
console.log("Disabled " + watchExpr); | |
} else { | |
watchFn = $scope.$watch(watchExpr, fn); | |
console.log("Enabled " + watchExpr); |
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 org.specs2.mutable._ | |
import org.specs2.specification._ | |
import org.specs2.matcher._ | |
import org.specs2.execute._ | |
import org.specs2.control.Debug | |
import org.specs2.main.ArgumentsShortcuts | |
import akka.testkit.TestKitBase | |
import akka.actor.ActorSystem |
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 MyActor extends TypedMessageActor { | |
import MyActor._ | |
def receive = ReceiveMessage[AllowedMessage] { | |
case Message1(text) => | |
... | |
case Message2 => | |
... | |
} | |
OlderNewer