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 '[clj-serializer.core :as serializer]) | |
(require '[clj-json.core :as m-json]) | |
(require '[org.danlarkin.json :as dl-json]) | |
(require '[clojure.contrib.json.read :as cc-json-read]) | |
(require '[clojure.contrib.json.write :as cc-json-write]) | |
(defn nano-time [] | |
(System/nanoTime)) | |
(defn timed [task] |
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
; orignal code | |
(def putinme (ref {})) | |
(for [itrId #{"A1HHSCH9YA57GL" "A13706T7S3HLRQ" "A2QNYO5VK24YE4"} ] | |
(dosync ( ref-set putinme ( assoc @putinme itrId {:val 1} ))) | |
) | |
@putinme | |
; for is lazy, body here is never executed; consider doseq |
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 '[clojure.contrib.shell-out :as shell]) | |
(require '[clojure.contrib.duck-streams :as streams]) | |
(let [eps (shell/sh "gnuplot" "-e" "set term postscript; plot sin(x)/x" :out :bytes)] | |
(with-open [out (streams/writer "example.eps")] | |
(streams/copy eps out))) |
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/bash | |
set -e | |
set -x | |
add-apt-repository "deb http://archive.canonical.com/ lucid partner" | |
cat << EOD | debconf-set-selections | |
sun-java5-jdk shared/accepted-sun-dlj-v1-1 select true | |
sun-java5-jre shared/accepted-sun-dlj-v1-1 select true |
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
; dependencies: | |
; http://build.clojure.org/releases/org/clojure/clojure/1.2.0/clojure-1.2.0.jar | |
; http://github.com/downloads/sirthias/parboiled/parboiled4j-0.9.8.2.jar | |
; http://github.com/downloads/sirthias/pegdown/pegdown-0.8.5.3.jar | |
(import 'org.pegdown.PegDownProcessor) | |
(def input-text " | |
A First Level Header | |
==================== |
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
}); | |
} | |
); | |
}); | |
}); | |
}); | |
}); | |
}); | |
}); | |
}); |
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 ruby | |
require 'rubygems' | |
require 'aws/s3' | |
class S3Cmd | |
include AWS::S3 | |
def initialize | |
Base.establish_connection!( |
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
;; "to help support nested routes and mounted applications within applications" | |
; we have some sub-apps we want to be active at different contexts | |
(defn blog-app [req] ...) | |
(defn forum-app [req] ...) | |
(defn core-app [req] ...) | |
; a heler function for setting up context keys | |
(defn in-context [context req] | |
(assoc req |
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
~/Desktop $ java -cp clojure-1.3.0-alpha2.jar:clj-stacktrace-0.2.0.jar clojure.main trace_test.clj | |
== java | |
java.lang.Exception: I regret to inform you that you are doing it wrong. | |
at user$biz.invoke(trace_test.clj:8) | |
at user$bat$f__104.invoke(trace_test.clj:12) | |
at user$bat.invoke(trace_test.clj:13) | |
at user$bar.invoke(trace_test.clj:17) | |
at user$foo.invoke(trace_test.clj:22) | |
at user$eval109.invoke(trace_test.clj:25) | |
at clojure.lang.Compiler.eval(Compiler.java:6168) |
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
~/Desktop $ java -cp clojure-1.3.0-alpha2.jar:clj-stacktrace-0.2.0.jar clojure.main trace_test.clj | |
== java | |
java.lang.Exception: I regret to inform you that you are doing it wrong. | |
at user$biz.invoke(trace_test.clj:8) | |
at user$bat$f__104.invoke(trace_test.clj:12) | |
at user$bat.invoke(trace_test.clj:13) | |
at user$bar.invoke(trace_test.clj:17) | |
at user$foo.invoke(trace_test.clj:22) | |
at user$eval109.invoke(trace_test.clj:25) | |
at clojure.lang.Compiler.eval(Compiler.java:6168) |