Skip to content

Instantly share code, notes, and snippets.

View ezducerdemo.cljs
(ns ezducerdemo)
;;
;; 1st take
;;
(defn ezducer [constructor]
(fn [reducer]
(let [steps (fn [a vs]
;; Use loop/recur instead of reduce to avoid reduce's
@ghadishayban
ghadishayban / functional_interfaces.clj
Last active February 4, 2019 17:52
SAM inference helpers
View functional_interfaces.clj
(import '[java.lang.reflect Method Modifier])
(set! *warn-on-reflection* true)
(defn- samsig
"Given a SAM interface, returns the j.l.reflect.Method of the abstract method"
[sym]
(let [kls (resolve sym)]
(if (and (class? kls) (.isInterface ^Class kls))
(let [mid (fn [^Method m] [(.getName m) (vec (.getParameterTypes m))])
@ghadishayban
ghadishayban / vendor_asm.sh
Created February 12, 2018 01:46
a script that vendors asm and writes itself as git commit 'transaction data'
View vendor_asm.sh
#!/bin/bash
# author Ghadi Shayban <gshayban@gmail.com>
set -e
if [ -z ${1+x} ]
then
echo provide an asm git sha / ref
exit 1
fi
@devn
devn / todo.exs
Last active December 1, 2017 22:38
do todo
View todo.exs
defmodule Do do
def dont think, about, it, but, please do
[think, about, it, please]
end
end
Do.dont :worry, :about, :grouping, :any, :arguments
=> [:worry, :about, :grouping, :arguments]
@pjstadig
pjstadig / core.clj
Created March 20, 2017 13:06
A little type hint hint
View core.clj
(ns typehint.core)
;; A little type hint hint...
(set! *warn-on-reflection* true)
;; There are two ways to type hint the return value of a function, but one is
;; (technically) wrong:
(defn ^String as-string0
@noprompt
noprompt / strum.clj
Created December 22, 2016 19:52
Macro for defining instrumented functions which verify their arguments and return values against specs.
View strum.clj
(ns strum.core
(:refer-clojure :exclude [defn])
(:require
[clojure.spec :as spec]
[clojure.spec.test :as spec.test]))
;; ---------------------------------------------------------------------
;; Prelude
;; HACK: Currently, as of Clojure 1.9.0-alpha14, there is a bug with
@lrascao
lrascao / gist:f57312ff33b799c4c0db56b10e80fe26
Created March 31, 2016 16:19
Export/Import datadog dashboards
View gist:f57312ff33b799c4c0db56b10e80fe26
dash_id=xxxx
api_key=xxx
app_key=xxx
# 1. export
curl -X GET "https://app.datadoghq.com/api/v1/dash/${dash_id}?api_key=${api_key}&application_key=${app_key}" > dash.json
# 2. edit dash.json
move "graphs", "title", "description" up one level in the json hierarchy, from being beneath "dash" to being at the same level
View blink.cljs.hl
@renestalder
renestalder / README.md
Last active December 1, 2023 13:27
Unfollow all on Facebook
View README.md

Facebook: Unfollow people and pages

See comments section for more up-to-date versions of the script. The original script is from 2014 and will not work as is.

  1. Open news feed preferences on your Facebook menu (browser)
  2. Click people or pages
  3. Scroll down (or click see more) until your full list is loaded
  4. Run the script in your browser console

Facebook will block this feature for you while you use it, depending on how much entities you try to unfollow. It automatically unblocks in a couple of hours and you will be able to continue.