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
Dir.foreach('.') do |filename| | |
next if filename == '.' or filename == '..' | |
# Do work on the remaining files & directories | |
r = /IMG_(.*?)_(.*?)[_\.].*/ | |
date_part = filename[r, 1] | |
time_part = filename[r, 2] | |
next unless date_part and time_part | |
d = date_part + time_part | |
d = d[0...-2] | |
v = `touch -mt #{d} '#{filename}'` |
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- add-call-log | |
[s] | |
(when-let [v (resolve s)] | |
(when-not (-> v meta :macro) | |
(let [current @v | |
patched (fn [& args] | |
(prn {:called-fn v :args args}) | |
(.applyTo ^clojure.lang.IFn current args))] | |
(alter-var-root v (constantly patched)))))) |
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 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))) |
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 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 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 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 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 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 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 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))) |
NewerOlder