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
{ | |
"_id" : ObjectId(“505a1614001b9c1a9cb10803"), | |
"password" : "$2a$12$vCew7zzXqtyRGKQV4xfSZ.KbmmCRMx.pVJD6DesTLrOvuUghB5Oeu", | |
"expiry_time" : ISODate(“2012-10-21T18:59:31.753Z"), | |
"invite_code" : "an-invite-code", | |
"activation_code" : "cbcff14" | |
} |
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
{ | |
"_id" : ObjectId("504ae6e2001b9c0548ab0b64"), | |
"password" : "$2a$12$vCew7zzXqtyRGKQV4xfSZ.KbmmCRMx.pVJD6DesTLrOvuUghB5Oeu", | |
"email" : "[email protected]", | |
"created_date" : ISODate(“2012-09-18T18:59:31.753Z") | |
} |
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
{ | |
"v" : 1, | |
"key" : { "expiry_time" : 1 }, | |
"ns" : "pymeals.user_invites", | |
"name" : "expiry_time_1", | |
"expireAfterSeconds" : 1 | |
} |
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
db.user_invites.ensureIndex( { "expiry_time": 1 }, { expireAfterSeconds: 1 } ) |
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 akka.actor._ | |
import akka.camel.{CamelExtension, CamelMessage, Consumer, Producer, Oneway} | |
import org.apache.activemq.camel.component.ActiveMQComponent | |
import org.apache.activemq.ScheduledMessage | |
case class Message(body: String) | |
class SimpleConsumer() extends Actor with Consumer { | |
def endpointUri: String = "activemq:foo.bar" |
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 io.github.cjwebb | |
import scala.annotation.tailrec | |
object Fibonacci extends App { | |
/** Get the nth fibonacci number */ | |
def fib_iter(n: Int) = { | |
if (n < 2) n | |
else { |
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
/** | |
* Problems from | |
* http://aperiodic.net/phil/scala/s-99/ | |
*/ | |
object NinetyNine extends App { | |
// P02 | |
def penultimate[A](l: List[A]): A = l match { | |
case h :: _ :: Nil => h | |
case h :: tail => penultimate(tail) |
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 RomanNumerals { | |
def toInt(romanNumerals: String): Int = { | |
@annotation.tailrec | |
def recur(l: List[Int], total: Int): Int = { | |
l match { | |
case h :: Nil => total + h | |
case h :: tail if h < tail.head => recur(tail, total - h) | |
case h :: tail => recur(tail, total + h) | |
case Nil => total // romans didn't have zero though | |
} |
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
({:date Monday 31 March 2014, :location Stadium of Light, :away-team West Ham, :score 1 - 2, :home-team Sunderland, :time 20:00} | |
{:date Sunday 30 March 2014, :location Anfield, :away-team Spurs, :score 4 - 0, :home-team Liverpool, :time 16:00} | |
{:date Sunday 30 March 2014, :location Craven Cottage, :away-team Everton, :score 1 - 3, :home-team Fulham, :time 13:30} | |
{:date Saturday 29 March 2014, :location Emirates Stadium, :away-team Man City, :score 1 - 1, :home-team Arsenal, :time 17:30} | |
{:date Saturday 29 March 2014, :location Selhurst Park, :away-team Chelsea, :score 1 - 0, :home-team Crystal Palace, :time 15:00} | |
{:date Saturday 29 March 2014, :location St. Mary's Stadium, :away-team Newcastle, :score 4 - 0, :home-team Southampton, :time 15:00} | |
{:date Saturday 29 March 2014, :location Britannia Stadium, :away-team Hull, :score 1 - 0, :home-team Stoke, :time 15:00} | |
{:date Saturday 29 March 2014, :location Liberty Stadium, :away-team Norwich, :score 3 - 0, :home-team Swansea, :time 15:00} | |
{:date Saturday 29 Ma |
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
{ | |
"id": "a1", | |
"title": "Top 3 Sandwiches", | |
"content": "They all contain bacon.", | |
"product_list": [ | |
"s1", "s2", "s3" | |
] | |
} |
OlderNewer