Problem 1: Nothing but the Truth [Elementary]
true
Problem 2: Simple Math [Elementary]
4
layout | title | date | comments | categories | tags | author |
---|---|---|---|---|---|---|
post |
Spree 1.0 deployment on Heroku |
2012-02-21 06:40 |
true |
spree, heroku, ruby, deployment, cedar stack |
Trung Lê |
;; Big thanks to Christophe Grand - https://groups.google.com/d/msg/clojure/L1GiqSyQVVg/m-WJogaqU8sJ | |
(defn scaffold [iface] | |
(doseq [[iface methods] (->> iface .getMethods | |
(map #(vector (.getName (.getDeclaringClass %)) | |
(symbol (.getName %)) | |
(count (.getParameterTypes %)))) | |
(group-by first))] | |
(println (str " " iface)) | |
(doseq [[_ name argcount] methods] | |
(println |
(require '[clojure.core.async :as a]) | |
(def xform (comp (map inc) | |
(filter even?) | |
(dedupe) | |
(flatmap range) | |
(partition-all 3) | |
(partition-by #(< (apply + %) 7)) | |
(flatmap flatten) | |
(random-sample 1.0) |
#!groovy | |
# Best of Jenkinsfile | |
# `Jenkinsfile` is a groovy script DSL for defining CI/CD workflows for Jenkins | |
node { | |
} |
(defn my-assoc-in | |
[m [k & ks] v] | |
(if (empty? ks) | |
(assoc m k v) | |
(assoc m k (my-assoc-in (k m) ks v)))) |
(require '[clj-http.client :as http]) | |
(require '[clojure.core.async :as a]) | |
(require '[clojure.string :as string]) | |
(require '[clojure.java.io :as io]) | |
(import '[java.io InputStream]) | |
(def event-mask (re-pattern (str "(?s).+?\r\n\r\n"))) | |
(defn- parse-event [raw-event] | |
(->> (re-seq #"(.*): (.*)\n?" raw-event) |
(defn base64-decode | |
"Utility function over the Java 8 base64 decoder" | |
[to-decode] | |
(String. (.decode (Base64/getDecoder) ^String to-decode))) | |
(defn string->edn | |
"Parse JSON from a string returning an edn map, otherwise nil" | |
[string] | |
(when-let [edn (json/decode string true)] | |
(when (map? edn) |
;; Adaptations of equations found in Jack Daniels - Daniels' Running Formula in clojure | |
(import (java.lang Math)) | |
(defn %VOmax | |
"Returns the percentage of VOmax a runner can sustain for the given duration" | |
[seconds] | |
(let [mins (/ seconds 60)] | |
(+ 0.8 | |
(* 0.1894393 | |
(Math/exp (* -0.012778 mins))) |