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
SFCCA = Function.prototype.apply.bind(String.fromCharCode, null); | |
SFCC = String.fromCharCode | |
/** | |
* Dispatch table for multi-byte UTF8 code points. | |
* | |
* Index of (utf8_prefix_byte - 0x80) is length of UTF8 byte | |
* sequence + 1. 0 means invalid prefix byte. | |
* | |
* @type {!Int8Array} | |
* @const |
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 rollback | |
"Reassert retracted datoms and retract asserted datoms in a transaction, | |
effectively \"undoing\" the transaction. | |
WARNING: *very* naive function!" | |
[conn tx] | |
(let [tx-log (-> conn d/log (d/tx-range tx nil) first) | |
txid (-> tx-log :t d/t->tx) | |
newdata (->> (:data tx-log) | |
(remove #(= (:e %) txid)) |
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 favila.async-util | |
"Some missing pieces of core.async. | |
as-transducer: Make a transducer function easily without Clojure 1.7. | |
go-pipe: async/pipe, but returns the go-loop. | |
fast-pipeline-blocking: faster than async/pipeline-blocking, but unordered results. | |
blocking-consumer: consume a channel with multiple worker threads." | |
(:require [clojure.core.async :as async | |
:refer [go go-loop <! >! <!! >!! close! take! put! chan]])) |
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- arguments-to-array | |
"This is the most jit-friendly way to turn arguments into an array. | |
js-this is a uint32 start index. | |
Call *exactly* like so: (.apply arguments-to-array start-index (js-arguments)) | |
Any other call pattern will prevent optimizations in calling function. | |
Returns a real js array of its arguments starting from start-index. | |
@param {...*} var_args" | |
[var_args] |
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 xyz | |
"Utilities for determining chunk position in XYZ files and processing | |
chunks using reducers. | |
Uses iota, which uses mmap()." | |
(:require [clojure.core.reducers :as r] | |
iota)) | |
(defn- step-chunk-starts | |
([] [(vector-of :int) 0 :find-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
(defn as-transducer [f] | |
"Convert function f into a transducer function. | |
This is merely a more convenient way to write an efficient reducing-step | |
function without the transducer signature. | |
The function should have the signature `(f transformer opaque-collection value)` | |
and return either `opaque-collection` or the return value of | |
`(transformer opaque-collection value)` to return new `opaque-collection` | |
things with `value` \"added\" to it. It can also box its return value 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
;; These colors are colorblind-safe | |
(def visual-uuid-colors #js ["#f0e442" "#0072b2" "#d55e00" "#cc79a7"]) | |
(def visual-uuid-shapes "▄▌▀▐" #_"◢◣◤◥" #_" █▖▗▘▝▚▞") | |
(defcomponent VisualUUID | |
"Draw an iconographic representation of a uuid meant for easy visual | |
recognition and comparision. | |
Every 4 bits becomes a color+shape; full uuid is an 8x4 grid of shapes." | |
[uuid] |
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
-- Optimized MYSQL schema for datomic | |
-- Unfortunately the bin/sql/mysql-*.sql bootstrapping files for datomic are not | |
-- very good, and can actually cause failures if not adjusted. | |
-- One symptom of this is the following error: | |
-- SQL Error (1071): Specified key was too long; max key length is 767 bytes. | |
-- Reported here: https://support.cognitect.com/entries/28462168-MySQL-Caveats | |
-- This is caused by the default collation for the `id` column possibly being |
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
#!/bin/sh | |
# A netcat-based logging http server for debugging. | |
# | |
# Writes raw http requests to individual files and replies with a 204. | |
PORT=${1-"8085"} | |
OUTFILEPREFIX=${2-"request"} | |
REPLY='HTTP/1.1 204 NO CONTENT\r\nconnection: close\r\n\r\n' | |
OUTFILE='' | |
cleanup () { |
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
#!/bin/sh | |
# Generate datomic transactor properties file and command line arguments. | |
# Specific scenario: using Google Mysql Cloud storage with SSL and client | |
# authentication. | |
OUTFILE='transactor.properties' | |
#TRANSACTOR_ARGS_FILE='transactor-arguments.txt' |