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
class Dog | |
speak: -> "woof" | |
legs: 4 |
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
(ns ocr.main | |
(:use [clojure.string :only (split trim)]) | |
(:use [clojure.contrib.duck-streams :only (write-lines read-lines)]) | |
(:use [clojure.contrib.shell-out :only (sh)]) | |
(:use [clojure.contrib.math :only (sqrt)])) | |
; Input handling | |
(defn read-text-image-line [line] | |
(if (= "white" (last (split line #"[,:\s]+"))) "0" "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
trait Functor[T[_]]{ | |
def fmap[A,B](f:A=>B)(ta:T[A]):T[B] | |
} | |
trait Applicative[T[_]] extends Functor[T]{ | |
def pure[A](a:A):T[A] | |
def <*>[A,B](tf:T[A=>B])(ta:T[A]):T[B] | |
} | |
trait Monad[M[_]] extends Applicative[M]{ |
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
(ns express_sample | |
(:require [cljs.nodejs :as node])) | |
(def express (node/require "express")) | |
(def app (. express (createServer))) | |
(defn -main [& args] | |
(doto app | |
(.use (. express (logger))) | |
(.get "/" (fn [req res] |
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
# unregister broken GHC packages. Run this a few times to resolve dependency rot in installed packages. | |
# ghc-pkg-clean -f cabal/dev/packages*.conf also works. | |
function ghc-pkg-clean() { | |
for p in `ghc-pkg check $* 2>&1 | grep problems | awk '{print $6}' | sed -e 's/:$//'` | |
do | |
echo unregistering $p; ghc-pkg $* unregister $p | |
done | |
} | |
# remove all installed GHC/cabal packages, leaving ~/.cabal binaries and docs in place. |
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
/** | |
* A functional Conway's game of life. | |
*/ | |
package object conwaydef { | |
type Coord[A] = (Int, Int) => A | |
type Calculator = Coord[Coord[Boolean] => Boolean] | |
type Size = Int | |
def nextCell(old: Boolean)(mates: Int) = if (mates > 3) false else if (mates == 3) true else (old && mates == 2) |
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
/* | |
* Starts jetty for scalatra programatically | |
* | |
* Replace YourApplicationEndpointFilter with the filter in your application | |
*/ | |
import org.eclipse.jetty.server.Server | |
import org.eclipse.jetty.servlet.{DefaultServlet, ServletContextHandler} | |
object JettyLauncher { | |
def main(args: Array[String]) { |
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
(defn bool-combinations [vs] | |
(loop [vs vs | |
a '({})] | |
(if (empty? vs) | |
a | |
(recur | |
(rest vs) | |
(flatten | |
(map | |
#(list |
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> | |
<title>Box Shadow</title> | |
<style> | |
.box { | |
height: 150px; | |
width: 300px; | |
margin: 20px; |
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
{ | |
// Sets the colors used within the text area | |
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme", | |
// Note that the font_face and font_size are overriden in the platform | |
// specific settings file, for example, "Base File (Linux).sublime-settings". | |
// Because of this, setting them here will have no effect: you must set them | |
// in your User File Preferences. | |
"font_face": "Monaco", | |
"font_size": 12, |