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
(ns tree | |
(:require [clojure.contrib.string :as str])) | |
(def postcodes '({:postcode "AL" :region-id 10} | |
{:postcode "AB" :region-id 12} | |
{:postcode "AL4" :region-id 10})) | |
(defn next-record | |
[record] | |
{:postcode (apply str (rest (:postcode record))) |
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
(ns tree | |
(:require [clojure.contrib.string :as str])) | |
(def postcodes '({:postcode "AB6" :region-id 9} | |
{:postcode "AL" :region-id 10} | |
{:postcode "AB" :region-id 12} | |
{:postcode "AL4" :region-id 10} | |
{:postcode "AL5" :region-id 9})) | |
(defn next-record |
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
(ns tree | |
(:require [clojure.contrib.string :as str] | |
[clojure.contrib.io :as io])) | |
(def lines (rest (io/read-lines "/Users/paul/Work/pes500k.csv"))) | |
(def postcodes-from-file (map (fn [x] (let [parts (str/split #"," x) | |
postcode (str/replace-str " " | |
"" | |
(first parts)) | |
region-id (first (rest parts))] |
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
(ns tree | |
(:require [clojure.contrib.string :as str] | |
[clojure.contrib.io :as io])) | |
(defrecord Node [postcode region-id]) | |
(def lines (rest (io/read-lines "/Users/paul/Work/pes_db.csv"))) | |
(def postcodes-from-file (map (fn [x] (let [parts (str/split #"," x) | |
postcode (str/replace-str " " | |
"" |
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
(use 'ring.adapter.jetty) | |
(require 'comparison.api) | |
(let [port (Integer/parseInt (get (System/getenv) "PORT" "8080"))] | |
(run-jetty #'comparison.api/app {:port port})) |
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
require 'formula' | |
class Hadoop < Formula | |
if ARGV.include?('--CDH') | |
url 'http://archive.cloudera.com/cdh/3/hadoop-0.20.2+737.tar.gz' | |
md5 '96f4c6ec8fadd1e86c0dfc8d2fe16aeb' | |
homepage 'http://www.cloudera.com/developers/' | |
version '0.20.2+737' | |
else | |
url 'http://www.carfab.com/apachesoftware/hadoop/core/hadoop-0.20.2/hadoop-0.20.2.tar.gz' |
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
(ns macrotest | |
(:require [clojure.contrib.string :as s] | |
[clojure.pprint :as pp]) | |
(:use clojure.test)) | |
(defn- generate-record-test | |
[f r {:keys [name actual name_key] :as record} body] | |
(let [n (gensym (eval (list f record)))] | |
`(let [~r ~record] | |
(deftest ~n |
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
(use 'ring.adapter.jetty) | |
(use 'ring.middleware.params) | |
(use 'ring.middleware.stacktrace) | |
(use 'clj-hoptoad.ring) | |
(defn app [req] | |
{:status 200 | |
:headers {"Content-Type" "text/html"} | |
:body (throw (Exception. "Testing"))}) |
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
;; #!/bin/sh | |
;; java -Djna.library.path=/usr/local/Cellar/libspotify/0.0.7/lib -server -cp "$CLASSPATH:lib/*:src/" clojure.main ./run.clj | |
(ns spotify-explore.run | |
(:use [clj-native.direct :only [defclib loadlib typeof]] | |
[clj-native.structs :only [byref byval]] | |
[clj-native.callbacks :only [callback]] | |
[clojure.contrib.string :only [join]])) | |
(def api-key-digits [0x01, 0x77, 0xC7, 0x76, 0x4C, 0x50, 0xDB, 0x51, 0x75, 0xD8, 0x92, 0x68, 0x9E, 0xD6, 0x75, 0x05, | |
0x0B, 0xFA, 0x7D, 0xE3, 0xD1, 0x36, 0xFF, 0x28, 0xA1, 0x0B, 0x56, 0x86, 0xA8, 0x8A, 0x9D, 0xA4, |
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
(defprotocol ToClojure | |
(to-clojure [x])) | |
(extend-protocol ToClojure | |
List (to-clojure [xs] (map to-clojure xs)) | |
RecommendedItem (to-clojure [x] {:item (.getItemID x) | |
:value (.getValue x)})) |