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
| if (_rules == null) | |
| _rules = CreateRules(); | |
| return _rules; | |
| // ...versus... | |
| return _rules ?? (_rules = CreateRules()); |
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 if-column | |
| [data column f] | |
| (if-not column | |
| data | |
| (f column data))) | |
| (defn where* [data condition-func] | |
| (if-column data condition-func filter)) | |
| (defn limit* [data lim] |
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 d-op [op d1 d2] | |
| (if (every? #(instance? org.joda.time.DateTime %) [d1 d2]) | |
| (op (c/to-long d1) (c/to-long d2)) | |
| (op d1 d2))) |
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
| public class JsonErrorViewModel | |
| { | |
| private JsonErrorViewModel(string error, dynamic parameters = null) | |
| { | |
| Error = error; | |
| Parameters = parameters; | |
| } | |
| public string Error { get; private set; } | |
| public dynamic Parameters { get; private set; } |
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
| class rock{} | |
| class paper{} | |
| class scissors{} | |
| public static class game{ | |
| public static object rps(rock r, paper p){return p;} | |
| public static object rps(rock r, scissors s){return r;} | |
| public static object rps(paper p, scissors s){return s;} | |
| } |
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
| var xs = _.chain(results) | |
| .sortBy(function (x) { return x.pos; }) | |
| .groupBy("level") | |
| .map(function (value, key) { return { depth: key, hits: value }; }) | |
| .value(); |
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
| private static string ContentToHtml(string content) | |
| { | |
| var words = content | |
| .Replace("\r\n", "<br/>") | |
| .Replace("\n", "<br/>") | |
| .Split(' ') | |
| //.Select(ReplaceLinkWithAttribute) | |
| .ToArray(); | |
| return String.Join(" ", words); |
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 total-memory | |
| [] | |
| (.totalMemory (Runtime/getRuntime))) | |
| (defn free-memory | |
| [] | |
| (.freeMemory (Runtime/getRuntime))) | |
| (def steps | |
| (->> ["B" "KB" "MB" "GB" "TB"] |
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 flock-staff.kafka | |
| (:require [cheshire.core :as json]) | |
| (:import [flock_staff.kafka StringProcessor StringForeachAction] | |
| [org.apache.kafka.common.serialization Serdes] | |
| [org.apache.kafka.streams.processor TopologyBuilder ProcessorSupplier] | |
| [org.apache.kafka.streams KafkaStreams StreamsConfig] | |
| [org.apache.kafka.clients.consumer ConsumerConfig] | |
| [java.util Properties])) | |
| (defn processor |
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 mustache | |
| (:require [clojure.string :as str])) | |
| (defn mustache | |
| [s args] | |
| (reduce | |
| (fn [result [k v]] | |
| (str/replace result | |
| (re-pattern (format "([^\\{])\\{%s\\}([^\\}])" (name k))) | |
| (format "$1%s$2" v))) |