Skip to content

Instantly share code, notes, and snippets.

Ticean Bennett ticean

Block or report user

Report or block ticean

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ticean / map-fields-comparator.clj
Last active Jan 10, 2020
Clojure comparator for sorting maps on n fields with sort order.
View map-fields-comparator.clj
(defmacro map-fields-comparator
"Comparator for sorting maps by field. `kw-orders` must be pairs of keywords
on which to sort and a sort direction, either :asc or :desc.
(map-fields-comparator :id :asc :time :desc)
The above is fine for key values that are inexpensive to compute from the values
being sorted. If the key values are expensive to compute, it is better to
ticean / inventory-data-flow.txt
Last active Jun 27, 2019 — forked from impactmass/inventory-data-flow.txt
sequence diagram for reaction inventory data flow
View inventory-data-flow.txt
title Inventory Data Flow
participant Kafka Topic
participant Shippable-Inventory-Plugin
participant Simple-Inventory-Plugin
participant Inventory
participant MongoDB SimpleInventory
participant MongoDB Products
participant MongoDB Orders
ticean /
Created Apr 29, 2019 — forked from ursuad/
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

bin/ --zookeeper localhost:2181 --list

Describe a topic

bin/ --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

bin/ --zookeeper localhost:2181 --alter --topic mytopic --config

... wait a minute ...

ticean / tinyrepl.clj
Last active Jul 14, 2018
Lil' Nestable Clojure REPL
View tinyrepl.clj
(def ^:dynamic repl-context)
(defn tinyrepl
"Simple REPL. :quit to exit."
[{:keys [prefix layer] :or {prefix "" layer 1} :as context}]
(let [pre (str prefix ">>>")]
(with-bindings {#'repl-context (assoc context
:prefix pre
:layer (inc layer))}
(print (str (ns-name *ns*) (str pre " ")))

Keybase proof

I hereby claim:

  • I am ticean on github.
  • I am ticean ( on keybase.
  • I have a public key whose fingerprint is 4027 3B22 CA85 EDBE A3C3 A3FD 678F F894 896B C705

To claim this, I am signing this object:

View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
ticean /
Created Aug 13, 2016 — forked from john2x/
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.


ticean / logfmt-demo.js
Last active Apr 20, 2016
Node.js Contextual Logging with Logfmt
View logfmt-demo.js
// Demo contextual log pattern with the logfmt-node library.
var logger = require('logfmt').namespace({app: "test"});
function task(id, throwError) {
var taskLogger = logger.namespace({event: "", "": id});
var taskTimer = taskLogger.time();
taskLogger.log({msg: "Starting the task.", at: "start"});
setTimeout(function() {
ticean /
Last active Aug 29, 2015 — forked from maxim/
How to use rails load paths, app, and lib directories.

In Rails 3

NOTE: This post now lives (and kept up to date) on my blog:

If you add a dir directly under app/

Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.

If you add a dir under app/something/

# This script will mount /Users in the boot2docker VM using NFS (instead of the
# default vboxsf). It's probably not a good idea to run it while there are
# Docker containers running in boot2docker.
# Usage: sudo ./
You can’t perform that action at this time.