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 ini | |
(require [clojure.string :as str] | |
[clojure.tools.logging :as log]) | |
(use clojure.test)) | |
(defn read [content] | |
(-> content | |
(str/replace #"\\\s*($|\n\s*)" "") | |
(str/split-lines))) |
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
(def ^:dynamic chunk-size 17) | |
(defn next-chunk [rdr] | |
(let [buf (char-array chunk-size) | |
s (.read rdr buf)] | |
(when (pos? s) | |
(java.nio.CharBuffer/wrap buf 0 s)))) | |
(defn chunk-seq [rdr] | |
(when-let [chunk (next-chunk rdr)] |
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
(require '[clojure.string :as str]) | |
(defn parse-line [line] | |
(let [line (str/replace line #"[\\]\s*(\n\s*|$)" "")] | |
(when-not (str/blank? line) | |
(let [[k v] (str/split line #"=" 2)] | |
[(str/trim k) (when-not (str/blank? v) (str/trim v))])))) | |
(defn parse [text] | |
(let [lines (str/split text #"(?<![\s\\])\s*\n")] |
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 component [ref render-fn & {:keys [on-mount on-unmount]}] | |
(let [comp (React/createClass (clj->js | |
{ :render (fn [] (crate/html (render-fn @ref))) | |
:componentDidMount (or on-mount identity) | |
:componentWillUnmount (or on-unmount identity) }))] | |
(add-watch ref :react | |
(fn [_ _ old new] | |
(when (not= old new) (.forceUpdate comp)))) | |
comp)) |
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 task02.network | |
(:use [task02 helpers query]) | |
(:require [clojure.java.io :as io] | |
[clojure.string :as str]) | |
(:import [java.net Socket ServerSocket InetAddress InetSocketAddress SocketException])) | |
(def inactive-timeout 20000) | |
;; Объявить переменную для синхронизации между потоками. Воспользуйтесь promise | |
(def ^{:private true :dynamic true} *should-be-finished* nil) |
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 opening? [sym] | |
(when (symbol? sym) | |
(.endsWith (name sym) ">"))) | |
(defn closing? [sym] | |
(when (symbol? sym) | |
(.startsWith (name sym) "<"))) | |
(defn split-closing [t exprs] | |
(split-with |
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
{ :+ | |
{ :editor | |
{ "pmeta-/" [:toggle-comment-selection] | |
"ctrl-shift-up" [:editor.sublime.selectLinesUpward] | |
"ctrl-shift-down" [:editor.sublime.selectLinesDownward] | |
"pmeta-d" [:editor.sublime.selectNextOccurrence] | |
"ctrl-m" [:editor.sublime.goToBracket] | |
"ctrl-shift-m" [:editor.sublime.selectBetweenBrackets] | |
"shift-pmeta-space" [:editor.sublime.selectScope] | |
"ctrl-pmeta-up" [:editor.sublime.swapLineUp] |
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
[~/work/dataserver-perf] lein run -m transit-perf | |
Reflection warning, /private/var/folders/5b/l86qswcd6x55f8scs4xv16ch0000gn/T/form-init1230410416827476545.clj:1:949 - call to static method invokeStaticMethod on clojure.lang.Reflector can't be resolved (argument types: unknown, java.lang.String, unknown). | |
JSON | |
WARNING: Final GC required 8.516571405051678 % of runtime | |
Evaluation count : 4842 in 6 samples of 807 calls. | |
Execution time mean : 127.405503 µs | |
Execution time std-deviation : 2.807037 µs | |
Execution time lower quantile : 124.163041 µs ( 2.5%) | |
Execution time upper quantile : 130.326300 µs (97.5%) |
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- send-udp [s port] | |
(with-open [socket (java.net.DatagramSocket.)] | |
(let [group (java.net.InetAddress/getByName "localhost") | |
bytes (.getBytes s) | |
packet (java.net.DatagramPacket. bytes (count bytes) group port)] | |
(.send socket packet) | |
(.close socket)))) | |
(deftask anybar [p port VAL int "AnyBar port"] | |
(let [port (or port 1738)] |
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
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.7.3/immutable.min.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mori/0.3.2/mori.js"></script> | |
<script type="text/javascript"> | |
var hex_chars = "0123456789abcdef"; | |
function rand_int(max) { | |
return Math.floor(Math.random() * max); | |
} |
OlderNewer