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
public class EntityModelBinder : IModelBinder | |
{ | |
private static readonly TypeConverter _converter = TypeDescriptor.GetConverter(typeof (Guid)); | |
public bool Matches(Type type) | |
{ | |
return type.CanBeCastTo<DomainEntity>(); | |
} |
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
/* Prelude.cs : What happens when a haskell programmer learns C#. | |
Copyright (c) 2011 Clark Gaebel | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the "Software"), | |
to deal in the Software without restriction, including without limitation | |
the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
and/or sell copies of the Software, and to permit persons to whom the | |
Software is furnished to do so, subject to the following conditions: |
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
upstream your-app { | |
# fail_timeout=0 means we always retry an upstream even if it failed | |
# to return a good HTTP response (in case the Unicorn master nukes a | |
# single worker for timing out). | |
server unix:/tmp/your_app.socket fail_timeout=0; | |
} | |
server { | |
listen 80; |
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.agent.Agent | |
import shapeless.Lens | |
import concurrent.Future | |
import akka.util.Timeout | |
import concurrent.ExecutionContext | |
object FocusedAgent { | |
implicit class EnrichedAgent[A](val agent: Agent[A]) extends AnyVal { | |
def focusOn[B](lens: Lens[A,B]): FocusedAgent[A,B] = new FocusedAgent[A,B](agent, lens) | |
} |
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 spray.json._ | |
import reactivemongo.bson._ | |
import scala.util.{ Try, Success, Failure } | |
import org.apache.commons.codec.binary.Hex | |
import org.joda.time.format.ISODateTimeFormat | |
import org.joda.time.{DateTime, DateTimeZone} | |
import java.nio.ByteBuffer | |
/** | |
* From https://gist.github.com/nevang/4690568 |
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
/** | |
* Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com> | |
*/ | |
package akka.contrib.mailbox | |
import scala.concurrent.duration._ | |
import java.util.concurrent.atomic.AtomicInteger | |
import java.util.concurrent.atomic.AtomicLong | |
import com.typesafe.config.Config | |
import akka.actor.{ ActorContext, ActorRef, ActorSystem, ExtendedActorSystem } |
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 deiko | |
import scala.concurrent.Future | |
import scala.concurrent.duration.Duration | |
import scalaz.concurrent.Task | |
import scalaz.stream._ | |
import play.api.libs.iteratee._ | |
import Process._ | |
object Conversion { |
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
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
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
IFS="$(printf '\n\t')" | |
mkdir -p ~/.ssh | |
if ! [[ -f ~/.ssh/authorized_keys ]]; then | |
echo "Creating new ~/.ssh/authorized_keys" | |
touch ~/.ssh/authorized_keys | |
fi | |
user=$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.persistence._ | |
object EventsourcingExample extends App { | |
class EventsourcedProcessor extends Processor { | |
var events: List[Any] = Nil | |
var awaitStack: List[Actor.Receive] = Nil | |
def receive = { | |
case Persistent(event, _) if recoveryRunning ⇒ update(event) |
OlderNewer