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
| ;; Match with guard function | |
| (match [{:a 2} {:b 3}] | |
| [{:a (_ :guard even?)} _] 1) | |
| ;; Match-with-fn example for same | |
| (match [{:a 2} {:b 3}] | |
| [{:a even?} _] 1) |
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 divide-coll | |
| "Divide collection of block heights into regions where water will be blocked. | |
| ex. | |
| [1 2 0 1 3 2 1 0 3] -> [[3 2 1 0 3] [2 0 1 3]]" | |
| [c] | |
| (let [regions (reduce (fn [coll i] | |
| (cond | |
| (seq coll) (let [[x & xs] coll | |
| from (first x) | |
| new-x (conj (vec x) i)] |
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 core-async-kafka.core | |
| (:require [clojure.core.async :refer [chan buffer go >!! <!! <! close! sliding-buffer]])) | |
| (defn process-message | |
| [msg status-chan] | |
| (>!! status-chan :in-progress) | |
| (Thread/sleep (rand-int 10000)) | |
| (println (format "Consumed %s message" msg)) | |
| (>!! status-chan :sucess)) |
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
| ;; project.clj | |
| ;; [clj-time "0.6.0"] | |
| ;; [org.clojure/data.json "0.2.4"] | |
| ;; [clj-kafka "0.2.8-0.8.1.1"] | |
| ;; Utility to find offsets in a given Kafka topic for a given | |
| ;; cursor/point in time. The code assumes that each message has a | |
| ;; monotonically increasing number (ex. unix timestamp) associated with | |
| ;; it. |
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
| Kaioken | |
| Initialize Kaioken | |
| Message received -> Consume messages | |
| Consume messages | |
| Message received -> Consume messages | |
| Enough messages received -> Bulk start | |
| Bulk start | |
| Data store - Success response -> Bulk success | |
| Data store - Retriable error -> Bulk start |
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
| Kaioken | |
| Initialize Kaioken | |
| Message received -> Consume messages | |
| Consume messages | |
| Message received -> Consume messages | |
| Enough messages received -> Bulk start | |
| Bulk start | |
| Bulk success -> Consume messages | |
| Retriable error -> Bulk start | |
| Non-recoverable error -> Exit |
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
| ABC | |
| No previous messages | |
| Open chat and Add message -> New Issue | |
| New Issue | |
| Agent sends message -> Issue in progress | |
| User sends message -> New Issue | |
| User deletes thread -> No previous messages | |
| Issue in progress | |
| Agent sends message -> Issue in progress | |
| User sends message -> Issue in progress |
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 info | |
| [{:keys [ns symbol class member] :as msg}] | |
| (let [[ns symbol class member] (map u/as-sym [ns symbol class member])] | |
| (if-let [cljs-env (cljs/grab-cljs-env msg)] | |
| (info-cljs cljs-env symbol ns) | |
| (let [var-info (cond (and ns symbol) (clj-info/info ns symbol) | |
| (and class member) (clj-info/info-java class member) | |
| :else (throw (Exception. | |
| "Either \"symbol\", or (\"class\", \"member\") must be supplied"))) | |
| ;; we have to use the resolved (real) namespace and name here |
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
| // ==UserScript== | |
| (function () { | |
| 'use strict'; | |
| let nowPlayingClassName = 'now-playing-tracklist-row' | |
| let buffer = []; | |
| let bindings = [ | |
| {binding: ["control", "f"], action: moveForward}, | |
| {binding: ["control", "b"], action: moveForward} |