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
#!/usr/bin/env bash | |
# Install script adapted from: | |
# https://gist.github.com/dwayne/2983873 | |
NODE_DIR="$HOME/.nodejs" | |
echo 'export PATH=$HOME/$NODE_DIR/bin:$PATH' >> ~/.bashrc | |
echo 'export NODE_PATH=$HOME/$NODE_DIR/lib/node_modules' >> ~/.bashrc | |
source ~/.bashrc |
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 object extensions { | |
import play.api.mvc._ | |
implicit class ResultExtensions(val result: PlainResult) | |
extends AnyVal { | |
def withLangCookie(lang: Lang)(implicit app: Application): PlainResult = | |
result.withCookies(Cookie(Play.langCookieName, lang.code, httpOnly = false)) | |
} | |
} |
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
// Helper for keeping track of the active project bindings | |
// (because we don't want to hard-code those inside singleton objects) | |
object Environment { | |
def currentBindings = | |
ref.get match { | |
case null => | |
throw new NullPointerException("No BindingModule currently registered (app not running?)") | |
case value => | |
value |
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 fsm | |
import scala.annotation.implicitNotFound | |
import scala.util.control._ | |
import RefContext._ | |
import Ref._ | |
/** | |
* Ref is a scoped type-safe mutable reference. | |
* |
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
// CONTEXT: https://groups.google.com/forum/#!topic/scala-user/8YpX1VkIkDs | |
import scala.annotation.implicitNotFound | |
import scala.language.experimental.macros | |
import scala.reflect.macros.whitebox | |
/** | |
* Macro-driven type for proving that an implicit parameter does not exist | |
* in scope. | |
*/ |
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 scala.annotation.tailrec | |
import scala.collection.SortedSet | |
import scala.concurrent.duration.{Duration, _} | |
import Cache._ | |
import Cache.ExpiryInfo.ordering | |
/** | |
* An immutable cache implementation. |
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
<link href="../topeka-elements/category-images.html" rel="import"> | |
<link href="../core-icon/core-icon.html" rel="import"> | |
<link href="../core-icons/core-icons.html" rel="import"> | |
<link href="../core-icons/av-icons.html" rel="import"> | |
<link href="../paper-fab/paper-fab.html" rel="import"> | |
<polymer-element name="my-element"> | |
<template> | |
<style> |
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
def recoverWith[T](source: Observable[T], pf: PartialFunction[Throwable, Observable[T]]) = | |
Observable.create[T] { subscriber => | |
implicit val s = subscriber.scheduler | |
val o = subscriber.observer | |
source.unsafeSubscribe(new Observer[T] { | |
def onNext(elem: T) = | |
o.onNext(elem) | |
def onError(ex: Throwable) = { |
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 java.security.MessageDigest | |
import java.util | |
import javax.crypto.Cipher | |
import javax.crypto.spec.SecretKeySpec | |
import org.apache.commons.codec.binary.Base64 | |
/** | |
* Sample: | |
* {{{ | |
* scala> val key = "My very own, very private key here!" |
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 language.experimental.macros | |
import scala.reflect.macros.Context | |
/** | |
* Provides type-safe equality and inequality operators, implemented with | |
* macros for efficiency reasons. | |
*/ | |
implicit class TypeSafeEquals[T](val self: T) extends AnyVal { | |
def ===[U](other: U): Boolean = macro TypeSafeEquals.equalsImpl[T, U] |