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 scalaz._, Scalaz._, NonEmptyList._ | |
sealed trait Interval[+A] { | |
val min: A | |
val max: A | |
def map[B: Order](f: A => B): Interval[B] = | |
Interval(f(min), f(max)) | |
def merge[AA >: A](i: Interval[AA])(implicit E: Enum[AA]): Option[Interval[AA]] = |
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 annotation.implicitNotFound | |
@implicitNotFound(msg = "This message can never appear!") | |
trait ~>[A, B] { self => | |
def apply(a: A): B | |
def invert(b: B): A = inverse.apply(b) | |
def inverse: B ~> A = new ~>[B,A] { | |
def apply(b: B) = self.invert(b) | |
override def invert(a: A) = self(a) | |
} |
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 foo.bar | |
import spray.routing._ | |
import spray.http._ | |
import spray.http.StatusCodes.Forbidden | |
// See https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS | |
case class Origin(origin: String) extends HttpHeader { |
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
# Upgraded git using Homebrew and now your __git_ps1() fails. Try something like this | |
# NB Still very fragile as had embedded version no | |
# enable git programmable completion features | |
if [ -f /usr/local/etc/bash_completion.d/git-completion.bash ]; then | |
. /usr/local/etc/bash_completion.d/git-completion.bash | |
fi | |
# enable git prompt |
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
path = require 'path' | |
fs = require 'fs' | |
balUtil = require 'bal-util' | |
Backbone = require 'backbone' | |
module.exports = (BasePlugin) -> | |
class Category extends Backbone.Model | |
constructor: -> |
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
apply plugin: 'java' | |
apply plugin: 'scala' | |
// For those using Eclipse or IntelliJ IDEA | |
apply plugin: 'eclipse' | |
apply plugin: 'idea' | |
def findPlay20(){ | |
def pathEnvName = ['PATH', 'Path'].find{ System.getenv()[it] != null } | |
for(path in System.getenv()[pathEnvName].split(File.pathSeparator)){ | |
for(playExec in ['play.bat', 'play.sh', 'play']){ |
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
;; Datomic sample code | |
;; schema query for attribute types in specified namespaces | |
(q '[:find ?attr | |
:in $ [?include-ns ...] ;; bind ?include-ns once for each item in collection | |
:where | |
[?e :db/valueType] ;; all schema types (must have a valueType) | |
[?e :db/ident ?attr] ;; schema type name | |
[(datomic.Util/namespace ?attr) ?ns] ;; namespace of name | |
[(= ?ns ?include-ns)]] ;; must match one of the ?include-ns |
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
# bash < <(curl -L http://da.gd/sbtinstall) | |
# Or, of course: | |
# bash < <(curl https://raw.github.com/gist/1736528/e9e978c81cc1f8a550973151d3922eede4c9b12a/gistfile1.sh) | |
mkdir -pv ~/bin/ | |
curl -o ~/bin/sbt-launch.jar http://typesafe.artifactoryonline.com/typesafe/ivy-releases/org.scala-tools.sbt/sbt-launch/0.11.2/sbt-launch.jar | |
echo 'java -Xmx512M -jar `dirname $0`/sbt-launch.jar "$@"' > ~/bin/sbt | |
chmod u+x ~/bin/sbt | |
echo 'Make sure ~/bin/ is in your $PATH and that you have a working `java` command.' | |
echo '* DONE *' |
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
# Add domains for which you want to force to an IP address here. | |
# This is the magic sauce for making *.#{hostname} | |
# always route to the localhost | |
address=/#{hostname}/127.0.0.1 | |
address=/#{hostname}/::1 | |
mx-host=#{hostname},#{hostname},10 | |
# Extra options that make dnsmasq play nice | |
log-queries |
NewerOlder