- exo CLI
- cs
- jq
This file contains 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
(require '[clojure.core.async :as a]) | |
(defn pull-seq | |
"Returns a (blocking!) lazy sequence read from a channel." | |
[c] | |
(lazy-seq | |
(a/>!! c :ready) | |
(when-let [v (a/<!! c)] | |
(cons v (pull-seq c))))) |
This file contains 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- new-window [counter prev ts] | |
(assoc counter :curr 0 :prev prev :last-ts ts)) | |
(defn- increase-count [counter val ts] | |
(assoc counter :curr val :last-ts ts)) | |
(defn- inc! [counter] | |
(swap! counter | |
(fn [{:keys [prev curr last-ts window-ms window-allow] :as atm}] |
This file contains 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 dispatch-fn [o] | |
(println (vals (select-keys o [:type :entity]))) | |
[(or (get o :type) ::any) | |
(or (get o :entity) ::any)]) | |
(def hiera (atom (-> (make-hierarchy) | |
(derive :string ::any) | |
(derive :object ::any)))) |
The usual Markdown Cheatsheet does not cover some of the more advanced Markdown tricks, but here is one. You can include verbatim HTML in your Markdown document. This is particularly useful for tables. Check this out:
Version 1Version 2
This file contains 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
const json = { | |
"routes": [{ | |
"legs": [{ | |
"summary": "Avenida Infante Dom Henrique, Autoestrada do Norte", | |
"weight": 11481.1, | |
"duration": 10976.2, | |
"steps": [{ | |
"intersections": [{ | |
"out": 0, | |
"entry": [true], |
This file contains 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
{ | |
"title": "Caps Lock (Fn) + IJKL", | |
"rules": [ | |
{ "description": "Caps Lock to fn", | |
"manipulators": [{"type": "basic", "from": {"key_code": "caps_lock", "modifiers": {"optional": ["any"]}}, "to": [{"key_code": "fn"}]}] }, | |
{ "description": "Fn + I/J/K/L to Arrow Keys", | |
"manipulators": [{"type": "basic", "from": {"key_code": "i", "modifiers": {"mandatory": ["fn"], "optional": ["any"]}}, "to": [{"key_code": "up_arrow"}] }, | |
{"type": "basic", "from": {"key_code": "j", "modifiers": {"mandatory": ["fn"], "optional": ["any"]}}, "to": [{"key_code": "left_arrow"}]}, | |
{"type": "basic", "from": {"key_code": "k", "modifiers": {"mandatory": ["fn"], "optional": ["any"]}}, "to": [{"key_code": "down_arrow"}]}, | |
{"type": "basic", "from": {"key_code": "l", "modifiers": {"mandatory": ["fn"], "optional": ["any"]}}, "to": [{"key_code": "right_arrow"}]}] }, |
This file contains 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 partition-while | |
"Given a coll, partition the coll whenever `(f a b)` returns `false`. | |
Example: `(partition-when #(<= 0 (Math/abs (- %1 %2)) 1) [1 2 3 5 6 8 10 10]) | |
returns `[[1 2 3] [5 6] [8] [10 10]]` | |
" | |
([f coll] (partition-while f coll [] [])) | |
([f [_ & t :as c] result intermediate] | |
(let [[a b & _] c] | |
(cond | |
(nil? a) result |
This file contains 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 com.heroku.sdk.CljKeyStore | |
"Dynamically generated class to allow creating custom key stores by directly passing the certs and keys | |
instead of relying on env vars" | |
(:gen-class | |
:name com.heroku.sdk.CljKeyStore | |
:extends com.heroku.sdk.EnvKeyStore | |
:methods [#^{:static true} [fromTrustWithRandomPassword [String] com.heroku.sdk.EnvKeyStore] | |
#^{:static true} [fromKeyAndCertWithRandomPassword [String String] com.heroku.sdk.EnvKeyStore]] | |
:constructors {[String String] [String String], | |
[String String String] [String String String]})) |
(:identity req)
is auth backend independent way to access user data- login and logout implementation depends on auth backend
:current-user
doesn't imply that authentication is required, route should also have:auth-rules
if authentication is required