Skip to content

Instantly share code, notes, and snippets.

(defn now-plus [n]
"Returns current time plus `n` minutes as string"
(let [f (SimpleDateFormat. "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")]
(.setTimeZone f (TimeZone/getTimeZone "GMT" ))
(.format f (Date. (+ (System/currentTimeMillis) (* n 60 1000))))))
@noisesmith
noisesmith / gist:7700208
Last active December 29, 2015 16:49 — forked from dabd/gist:7700137
(defn best
[f [h & t]]
(reduce #(if (f %1 %2) %1 %2) h t))
(defn most
[f [h & t :as coll]]
(if (seq coll)
(reduce (fn [[wins wins-score] x]
(let [x-score (f x)]
(if (> wins-score x-score)
@noisesmith
noisesmith / gist:6502843
Last active December 22, 2015 16:59 — forked from tdreyno/gist:6502823
(defn home-api-map
[]
{ :banner (model/pick :banner {:where {:slug "home"}})
:intro-headline (model/pick :headline {:where {:slug "intro"}})
:intro-slides (model/gather :slides {:where {:slug "intro"} :include {:slides {}}})
:intro-highlights (model/gather :highlight {:where {:slug "intro"}})
:tenants (model/gather :tenant)
:partners (model/gather :neighborhood-partner)
:whats-here-headline (model/pick :headline {:where {:slug "whats-here"}})
:project-highlights (model/gather :project-highlights {:include {:highlights {}}})
(ns clojure.gdx.myscreen
(:import (com.badlogic.gdx Gdx Screen)
(com.badlogic.gdx.scenes.scene2d Stage)
(com.badlogic.gdx.scenes.scene2d.ui Label Label$LabelStyle)
(com.badlogic.gdx.graphics Color)
(com.badlogic.gdx.graphics.g2d BitmapFont)
(com.badlogic.gdx.graphics.g2d SpriteBatch)))
(declare ^Stage stage)