Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.
;; Example implementation of Norvig's Spellchecker in Clojure, | |
;; using core.async | |
;; | |
;; There are probably some bugs in this. | |
;; | |
;; Original problem: https://github.com/ericnormand/spelling-jam | |
;; from Lambda Jam, Chicago, 2013: http://lambdajam.com/ | |
;; | |
;; Clojure core.async introduction: | |
;; http://clojure.com/blog/2013/06/28/clojure-core-async-channels.html |
var mongoose = require('mongoose'); | |
var repository = function (modelName) { | |
var self = this; | |
self.Model = require('../models/' + modelName); | |
self.FindById = function (id, cb) { | |
self.FindOne({ |
# -*- mode: ruby -*- | |
Vagrant.configure("2") do |config| | |
config.vm.box = "precise64" | |
config.vm.box_url = "http://files.vagrantup.com/precise64.box" | |
config.vm.network :public_network, :bridge => "eth0" | |
config.vm.synced_folder "data", "/data" | |
config.vm.synced_folder "mesos", "/mesos" | |
config.vm.synced_folder "/home/dln/src/mesos-docker/target/scala-2.10", "/mesos/mesos-docker" | |
config.vm.synced_folder "salt", "/srv/salt" |
Hi there!
The docker cheat sheet has moved to a Github project under https://github.com/wsargent/docker-cheat-sheet.
Please click on the link above to go to the cheat sheet.
import org.specs2._ | |
import matcher._ | |
import execute._ | |
import specification._ | |
// the "larger" context must be mixed-in last | |
class MySpec extends mutable.Specification with Db with Web { | |
// prints | |
// on the web | |
// in the db |
Scala 2013 – The year in review | |
------------------------------- | |
January | |
------- | |
The new year started with a huge patch set by Paul, focused on improving scalac's handling of variance¹ and a large-scale cleanup of deprecated members and types² by Simon, as well as build managers in favor of SBT and Zinc¹¹ by Jason. | |
Heather added tons of documentation to IsTraversableLike³ while James fixed the handling of value type refinements which were causing a verify error on a getClass call ¹². |
THIS GIST WAS MOVED TO TERMSTANDARD/COLORS
REPOSITORY.
PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!
import scala.concurrent.{ExecutionContext, Future} | |
import spray.routing.{AuthenticationFailedRejection, RequestContext} | |
import spray.routing.authentication.{Authentication, ContextAuthenticator} | |
/** Token based authentication for Spray Routing. | |
* | |
* Extracts an API key from the header or querystring and authenticates requests. | |
* | |
* TokenAuthenticator[T] takes arguments for the named header/query string containing the API key and | |
* an authenticator that returns an Option[T]. If None is returned from the authenticator, the request |
import scala.slick.lifted.CanBeQueryCondition | |
// optionally filter on a column with a supplied predicate | |
case class MaybeFilter[X, Y](val query: scala.slick.lifted.Query[X, Y]) { | |
def filter[T,R:CanBeQueryCondition](data: Option[T])(f: T => X => R) = { | |
data.map(v => MaybeFilter(query.filter(f(v)))).getOrElse(this) | |
} | |
} | |
// example use case | |
import java.sql.Date |
class DynamicTestClass() { | |
def output() { | |
println("Hello from a dynamically sent class") | |
} | |
} | |
def testFunc[T : Manifest]() : T = { | |
manifest[T].erasure.newInstance().asInstanceOf[T] | |
} | |
val dynamicTestClassInstance = testFunc[DynamicTestClass]() |