Skip to content

Instantly share code, notes, and snippets.

@thickey
thickey / flatmap.clj
Last active December 22, 2023 05:42
Example in Clojure of round-tripping a hierarchical map to/from a flattened version
(ns flatmap
(:require [clojure.string :as str]))
(def default-delimiter \$)
;; via https://stackoverflow.com/questions/31704704/depth-first-tree-traversal-accumulation-in-clojure/31709202#31709202
(defn traverse [t]
(letfn [(traverse- [path t]
(when (seq t)
@thickey
thickey / cider+deps.md
Last active March 9, 2023 17:47
Cider jack-in with tools.deps

Instructions

Note: you must have Cider version 0.18.*

For pure tools.deps (non-lein)

In deps.edn

{:paths ["src" "resources"]
 :deps {org.clojure/clojure {:mvn/version "1.9.0"}}
@thickey
thickey / deps+nrepl.md
Last active October 26, 2018 19:57 — forked from solussd/deps+nrepl.md
nrepl + deps.edn quickstart

Instructions

  1. Add nrepl server dep to deps.edn :dev alias extra deps
org.clojure/tools.nrepl {:mvn/version "0.2.12"}
  1. create dev/user.clj containing the following:
(ns user
 (:require [clojure.tools.nrepl.server :as nrepl]))
@thickey
thickey / README.md
Last active October 14, 2017 17:10
Handling multiple results from Clojure with SQL the includes temp tables

Handling multiple results from SQL that includes temp tables.

NB! this is using clojure.java.jdbc v0.6.1, as we have performance issues w/ 0.7.x

Although this gist was very helpful when all statements return results, this is what is ultimately needed to properly traverse the intermediate reults that return nothing (e.g. temp tables).

Keybase proof

I hereby claim:

  • I am thickey on github.
  • I am thickey (https://keybase.io/thickey) on keybase.
  • I have a public key whose fingerprint is 0ED7 4731 F2C7 F5EE 5635 8BB7 818A EC24 E433 4A5D

To claim this, I am signing this object:

@thickey
thickey / core.cljs
Last active August 29, 2015 14:17 — forked from scttnlsn/core.cljs
(ns nested-routing.core
(:require-macros [om.core :as om]
[secretary.core :refer [defroute]])
(:require [om.dom :as dom]
[om.core :as om]
[secretary.core :as secretary]
[goog.events :as events]
[goog.history.EventType :as EventType])
(:import goog.History))

Keybase proof

I hereby claim:

  • I am thickey on github.
  • I am thickey (https://keybase.io/thickey) on keybase.
  • I have a public key whose fingerprint is 0F57 43A7 EEA0 7E10 A21C 2246 3036 3ED5 7F1F 6258

To claim this, I am signing this object:

@thickey
thickey / init.el
Last active August 29, 2015 14:07 — forked from martintrojer/init.el
;; Clojure
(require 'clojure-mode)
(setq auto-mode-alist (cons '("\\.cljs$" . clojure-mode) auto-mode-alist))
(setq inferior-lisp-program "lein repl")
;; clj-refactor
(require 'clj-refactor)
(add-hook 'clojure-mode-hook (lambda ()
(clj-refactor-mode 1)
(cljr-add-keybindings-with-prefix "C-c C-o")))
function Retry-Command
{
param (
[Parameter(Mandatory=$true)][string]$command,
[Parameter(Mandatory=$true)][hashtable]$args,
[Parameter(Mandatory=$false)][int]$retries = 5,
[Parameter(Mandatory=$false)][int]$secondsDelay = 2
)
# Setting ErrorAction to Stop is important. This ensures any errors that occur in the command are
@thickey
thickey / human_log.py
Last active August 29, 2015 14:06 — forked from steinim/human_log.py
FIELDS = ['cmd', 'command', 'start', 'end', 'delta', 'msg', 'stdout', 'stderr']
def human_log(res):
if type(res) == type(dict()):
for field in FIELDS:
if field in res.keys():
encoded_field = res[field].encode('utf-8')
print '\n{0}:\n{1}'.format(field, encoded_field)