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 localstorage) | |
(defn set-item! | |
"Set `key' in browser's localStorage to `val`." | |
[key val] | |
(.setItem (.-localStorage js/window) key val)) | |
(defn get-item | |
"Returns value of `key' from browser's localStorage." | |
[key] |
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 aws-s3-upload-clj.demo | |
(:use [hiccup page] | |
[ring.util.codec]) | |
(:import (javax.crypto Mac) | |
(javax.crypto.spec SecretKeySpec)) | |
(:require [compojure.core :refer [GET defroutes]] | |
[clj-time.core :as time] | |
[clj-time.format :as time-f] | |
[clojure.data.json :as json] | |
[compojure.route :as route] |
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 stopwatch) | |
(defn seconds-to-time | |
[secs] | |
(let [d (js/Date. (* secs 1000))] | |
{:hours (.getUTCHours d) | |
:minutes (.getUTCMinutes d) | |
:seconds (.getUTCSeconds d)})) | |
(defn display-time |
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
(defn csv-to-sexp | |
"Parses the string `csv` as a comma-separated-value file, | |
returning a sexp containing the values with strings converted to | |
numbers where appropriate." | |
[csv] | |
(map (fn [s] (map #(let [i (string/trim %) | |
r-s (read-string i)] | |
(if (number? r-s) r-s i)) (string/split s #","))) | |
(string/split-lines csv))) |
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 dataartclj.nyt-monkeys | |
(:use quil.core) | |
(:use ring.util.codec) | |
(:require [cheshire.core :refer :all])) | |
(def api-key "removed") | |
(def base-url "http://api.nytimes.com/svc/search/v2/articlesearch.json?") | |
(def w 1280) | |
(def h 720) |
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
;; "Πυργεωμετρία ('Pyrgi-ometry')", a Processing sketch using Clojure and Quil | |
(ns livecode.pyrgi | |
(:use quil.core)) | |
(def stripe-height 50) | |
(def canvas-height (* 9 stripe-height)) | |
(def canvas-width (* canvas-height (/ 3 2))) | |
;; Color conversion, courtesy of Jack Rusher | |
(defn hex-to-color [hex] |
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
(defn setup [] | |
(frame-rate 4) | |
(no-fill) | |
(stroke 0 0 0 128) | |
(smooth)) | |
(def rotor (atom 0)) | |
(def zoomer (atom 200)) | |
(def zoomer-flag (atom 1)) |
NewerOlder