git clone git://github.com/clojure/clojurescript.git
cd clojurescript
./script/bootstrap
In ClojureScript dir
export CLOJURESCRIPT_HOME=$HOME/
export PATH=$PATH:$CLOJURESCRIPT_HOME/bin:$CLOJURESCRIPT_HOME/script
Postgresql Cheat Sheet | |
=============================== | |
start: psql -U username databasename | |
quit: \q | |
list all: \d | |
list tables: \dt | |
list all databases: \l |
:javascript | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', YOUR_CODE']); | |
_gaq.push(['_trackPageview']); | |
(function() { | |
var ga = document.createElement('script'); | |
ga.type = 'text/javascript'; ga.async = true; | |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | |
})(); |
(defprotocol IO | |
"A protocol for reading and writing" | |
(read-file [this]) | |
(write-file [this])) | |
(extend-protocol IO | |
String | |
(read-file [file] | |
(with-open [rdr (clojure.java.io/reader file)] | |
(reduce conj [] (line-seq rdr)))) |
(ns selenium-test.core | |
(:use midje.sweet) | |
(:use [clj-webdriver.taxi])) | |
(set-driver! {:browser :firefox}) | |
(to "http://www.boxuk.com/") | |
(facts "About the homepage" | |
(visible? "#content") => true) |
from math import sqrt | |
# Sieve of Erastothenes | |
def sieve(n): | |
candidates = list(range(n)) | |
# We only need to check up to the square root of n | |
upto = int(sqrt(n)) + 1 |
(ns euler.problem7 | |
(:use [euler.core])) | |
;; The algorithm for this is | |
;; - Start at the first 1000 primes | |
;; - If there are not enough primes then try again at 2000 etc | |
(defn get-nth-prime [n, max] | |
"Returns the nth prime" | |
(let [primes (sieve max)] |
# A Micro DSL for NET/HTTP | |
require 'net/http' | |
require 'net/https' | |
require "uri" | |
# Base class for making HTTP connections | |
module Query | |
def group_sequence_by n, sequence | |
Array.new.tap do |result| | |
sequence.each_slice(n) { |item| result << item } | |
end | |
end |