I hereby claim:
- I am nhusher on github.
- I am nh (https://keybase.io/nh) on keybase.
- I have a public key whose fingerprint is EF28 2E9A A2DA BAA4 5BB1 CC5A 8906 B88A 7D0F B6F1
To claim this, I am signing this object:
| (ns calc.core | |
| (:require | |
| [instaparse.core :as insta] | |
| [clojure.pprint :refer [pprint]])) | |
| ; Define a parser: | |
| (def parser | |
| (insta/parser | |
| " | |
| <expr> = sum-expr |
| const A = 'A'.charCodeAt(0) | |
| const cipher = offset => character => | |
| String.fromCharCode(A + (offset + character.toUpperCase().charCodeAt(0) - A) % 26) | |
| const encode = (s, d) => s.replace(/\W/g,'').split('').map(cipher(d)).join('') | |
| const decode = (s, d) => s.split('').map(cipher(26 - d)).join('') | |
| decode(encode("Friends, Romans, Countrymen, lend me your ears!", 10), 10) | |
| // => 'FRIENDSROMANSCOUNTRYMENLENDMEYOUREARS' |
| /* | |
| ensure :: { String: Any } => void, throws Error | |
| Checks to see if you are failing to pass in any arguments. | |
| Example: | |
| function doSomethingToUser(userName, userEmail) { | |
| ensure({ userName, userEmail }); | |
| // do stuff... |
I hereby claim:
To claim this, I am signing this object:
| (ns timeline.roller | |
| (:require [instaparse.core :as insta]) | |
| (:use [clojure.string :only [join]])) | |
| ; | |
| ; -- Parsing code ----------------------------------------------------------- | |
| ; | |
| ; Known limitations | |
| ; - no negative numbers |
| var chan1 = new Channel(), | |
| chan2 = new Channel(), | |
| chan3 = new Channel(); | |
| setTimeout(function() { chan1.put("Hello!"); }, Math.random() * 1000); | |
| setTimeout(function() { chan2.put("How are you?"); }, Math.random() * 1000); | |
| setTimeout(function() { chan3.put("Very good."); }, Math.random() * 1000); | |
| setTimeout(function() { chan1.put("Thank you very much."); }, Math.random() * 1000 + 1000); | |
| Promise.all([ chan1, chan2, chan3 ]).then(([ _1, _2, _3 ]) => { |
| function json(u, t) { | |
| return xhr(u, t || 'GET', { | |
| Accept: 'application/json', | |
| Authorization: 'Bearer ' + localStorage.token | |
| }).then(function(v) { | |
| return JSON.parse(v.responseText); | |
| }, function(e) { | |
| console.error(e); | |
| return {}; | |
| }) |
| (defn loan-payment [ principal monthly-interest months ] | |
| (float | |
| (max 0 | |
| (if (zero? monthly-interest) | |
| (/ principal months) | |
| (* principal | |
| (/ monthly-interest | |
| (- 1 (Math/pow | |
| (+ 1 monthly-interest) | |
| (- months))))))))) |
| (ns timeline.db | |
| (:import org.bson.types.ObjectId) | |
| (:require [ monger.core :as mg ] | |
| [ monger.collection :as mc ] | |
| [ com.palletops.leaven :as leaven ] | |
| [ taoensso.timbre :as timbre ] | |
| [ clojure.core.async :refer (go-loop go chan alts! put! <! <!! >! close! dropping-buffer) ] | |
| [ com.palletops.leaven.protocols :refer (Startable Stoppable) ] | |
| [ timeline.macros :refer (alt-over) ])) |