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 com.youdevise.matchless | |
import org.specs2.matcher.MustMatchers._ | |
import com.youdevise.matchless.Collections._ | |
object HasThePairsWorksheet { | |
val testMap = Map( | |
"a" -> "Apple", | |
"b" -> "Banana", | |
"c" -> "Carrot" |
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 com.youdevise.lofty | |
import org.specs2.mutable._ | |
import scala.language.dynamics | |
import scala.language.reflectiveCalls | |
import scalaz._ | |
import Scalaz._ | |
import scala.reflect.runtime.universe._ | |
trait Builder[T] { |
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 com.youdevise.lofty | |
import org.specs2.mutable._ | |
import scala.language.dynamics | |
trait State[S, A] { | |
val runState: Function[S, (S, A)] | |
def flatMap[B](f: A => Function[S, (S, B)]):Function[S, (S, B)] = (state:S) => { | |
val (newState, value) = runState(state) | |
f(value)(newState) |
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/python | |
import urllib2 | |
import argparse | |
import json | |
parser = argparse.ArgumentParser(description="Fetch some JSON") | |
parser.add_argument("url") | |
args = parser.parse_args() |
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 RangeSetsTest { | |
@Test public void | |
an_empty_list_of_ranges_is_coalesced_to_an_empty_set() { | |
Collection<Range<Integer>> ranges = newArrayList(); | |
assertThat(RangeSets.containing(ranges).size(), Matchers.is(0)); | |
} | |
@SuppressWarnings("unchecked") |
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
Iterators = (function() { | |
var each, map, filter, reduce, toArray, toObject; | |
function _map(iter, f) { | |
return { | |
hasNext: iter.hasNext, | |
next: function() { return f(iter.next()); } | |
}; | |
} | |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | |
<script src="scanva.js"></script> | |
<script src="particles.js"></script> | |
</head> | |
<body> | |
<canvas width="500px" height="500px" id="canvas"></canvas> | |
</body> |
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
1 (ns poker.core | |
2 (:use clojure.contrib.string)) | |
3 | |
4 (defrecord Card [value suit]) | |
5 | |
6 (def VALUE { | |
7 "1" :one | |
8 "2" :two | |
9 "3" :three | |
10 "4" :four |
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
"use strict"; | |
// compose :: (b -> c) -> (a -> b) -> (a -> c) | |
function compose(g, f) { | |
return function() { | |
return g(f.apply(f, arguments)); | |
}; | |
} | |
// each :: [a] -> (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
'use strict'; | |
var slothful = (function() { | |
function _(step) { | |
var getResult = function() { return step(); }; | |
return function() { | |
var result = getResult(); | |
getResult = function() { return result; } | |
return result; |
NewerOlder