This file contains hidden or 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
| sbtPlugin := true | |
| name := "sbt-build-info" | |
| organization := "com.tapad" | |
| version := "0.1.3" | |
| credentials += Credentials(Path.userHome / ".ivy2" / ".credentials") |
This file contains hidden or 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.math.{BigInt, BigDecimal} | |
| object RecursiveStreams | |
| { | |
| // natural numbers | |
| lazy val N: Stream[BigInt] = Stream.cons(BigInt(1), N.map(_ + 1)) | |
| // fibonacci series | |
| lazy val fib: Stream[BigInt] = Stream.cons(BigInt(0), Stream.cons(BigInt(1), fib.zip(fib.tail).map(a => a._1 + a._2))) |
This file contains hidden or 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.stm._ | |
| import scala.collection.immutable.ListMap | |
| case class LRUCache[A, B](private val MAX_ENTRIES: Int) | |
| { | |
| protected val cache = Ref(ListMap.empty[A, B]) | |
| def getOrElse(key: A)(fn: => B): B = { | |
| get(key).getOrElse { | |
| val result = fn |
This file contains hidden or 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
| -module(objectid). | |
| -author("[email protected]"). | |
| -export([binary_to_hex/1]). | |
| extract_binary_data(BsonObjectId) -> | |
| case BsonObjectId of {Binary} -> Binary; Binary -> Binary end. | |
| binary_to_hex(BsonObjectId) -> | |
| Binary = extract_binary_data(BsonObjectId), | |
| list_to_binary(lists:flatten([io_lib:format("~2.16.0b", [X]) || <<X:8>> <= Binary])). |
This file contains hidden or 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 python2.6 | |
| import abc | |
| class Kind(object): | |
| __metaclass__ = abc.ABCMeta | |
| kindtypes = dict() | |
| datatypes = list() |
This file contains hidden or 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 sys, json | |
| import flow | |
| class Context(object): | |
| CATEGORIES = { | |
| 'a': { 'parent': None }, | |
| 'b': { 'parent': 'a' }, | |
| 'c': { 'parent': 'a' }, | |
| 'd': { 'parent': 'b' }, | |
| 'e': { 'parent': 'd' }, |
This file contains hidden or 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 sys, json | |
| import flow | |
| class Context(object): | |
| def __init__(self, client): | |
| client.set_logger_file('fgc.out') | |
| self.client = client | |
| self.create_application() | |
| self.create_application_flows() |
This file contains hidden or 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 com.olchovy.format | |
| import scala.xml._ | |
| import net.liftweb.json.JsonAST._ | |
| trait Formatter[-A, B] { | |
| def format(a: A): B | |
| } | |
| object Formatters { |
This file contains hidden or 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
| function Debug() { | |
| var frame = window.open("", "Debugger", "location=no,scrollbars=yes,height=300,width=400"); | |
| var console = frame.document.createElement("div"); | |
| console.setAttribute("id", "console"); | |
| console.style.margin = "auto"; | |
| console.style.width = "350px"; | |
| console.style.overflow = "auto"; | |
| frame.document.body.appendChild(console); |
This file contains hidden or 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
| function extend(p, c) | |
| { | |
| var f = function() {}; | |
| f.prototype = p.prototype; | |
| c.prototype = new f(); | |
| c.prototype.constructor = c; | |
| } | |
| function mixin(p, c) | |
| { |
NewerOlder