Skip to content

Instantly share code, notes, and snippets.

View emidln's full-sized avatar

Brandon Adams emidln

  • Chicago, IL
View GitHub Profile
anonymous
anonymous / omni_mentor_trade.txt
Created July 14, 2015 02:02
4 Force of Will
4 Brainstorm
4 Ponder
4 Preordain
4 Show and Tell
4 Omniscience
4 Cunning Wish
2 Spell Pierce
4 Gitaxian Probe
4 Dig Through Time
@skwp
skwp / private_constants.rb
Created July 14, 2015 22:05
private_constants.rb
# A simple way to create private constants without all the noise of ruby's 'private_constant'
#
# Before:
# class Foo
# FOO = "bar"
# private_constant :FOO
# end
#
# After:
# class Foo
@kendagriff
kendagriff / while.clj
Last active September 9, 2015 14:31
while->
(defmacro while->
"As long as the predicate holds true, threads
the expr through each form (via `->`). Once pred returns
false, the current value of all forms is returned."
[pred expr & forms]
(let [g (gensym)
pstep (fn [step] `(if (~pred ~g) (-> ~g ~step) ~g))]
`(let [~g ~expr
~@(interleave (repeat g) (map pstep forms))]
~g)))
@mikeball
mikeball / core.clj
Last active June 3, 2020 13:22
Postgres listen/notify in Clojure using http://impossibl.github.io/pgjdbc-ng/
; Postgres listen/notify in Clojure using http://impossibl.github.io/pgjdbc-ng/
; in project.clj dependencies
; [com.impossibl.pgjdbc-ng/pgjdbc-ng "0.5"]
(ns pglisten.core
(:import [com.impossibl.postgres.jdbc PGDataSource]
[com.impossibl.postgres.api.jdbc PGNotificationListener]))
@dimiro1
dimiro1 / calculator.thrift
Last active December 30, 2015 20:37
Implementation of the Thrift Servlet with Clojure Ring/compojure - A Working example https://github.com/dimiro1/thrift-clojure-example
service Calculator {
i64 sum(1: i64 a, 2: i64 b)
}
@divs1210
divs1210 / SLIP.py
Last active January 10, 2025 18:29
helps escape the Python's clutch
import types
# Helpers
# =======
def _obj():
'''Dummy object'''
return lambda: None
_FILLER = _obj()
@danboykis
danboykis / file_size_rolling_appender.clj
Created July 25, 2017 16:10
a size based rolling appender
(ns example.file-size-rolling-appender
"Rolling file appender."
(:require [clojure.java.io :as io]
[taoensso.timbre :as timbre])
(:import [java.io File]
[java.text SimpleDateFormat]))
;; TODO Test port to Timbre v4
(defn- rename-old-create-new-log [^File log ^File old-log]