Skip to content

Instantly share code, notes, and snippets.


Yehonathan Sharvit viebel

View GitHub Profile
View clojure_spec_missing_piece.clj
;; clojure.spec's missing piece, work in progress
;; this is only halfway done, somebody else will need to do the other 95%
'[clojure.spec :as s]
'[clojure.spec.test :as test])
(defn naive-english-explain
"Copy and paste this into your app. Figure out what it does by
trying it in production."
bzg / gist:5f9a952208cf8d35220a41a8ff857faa
Created Dec 6, 2016
Org-mode + KLIPSE to demo Clojure code
View gist:5f9a952208cf8d35220a41a8ff857faa
#+html_head_extra: <link rel="stylesheet" type="text/css" href="" />
Some Clojure code:
#+BEGIN_SRC clojure
(map inc '(1 2 3))
That's it.
View drunken-walk.clj
(defn neighbors
([size yx] (neighbors [[0 0] [1 1] [-1 -1] [-1 1] [1 -1] [-1 0] [1 0] [0 -1] [0 1]] size yx))
([deltas size yx]
(filter (fn [new-yx]
(every? #(< -1 % size) new-yx))
(map #(vec (map + yx %))
(defn density [matrix y x]
(let [neighbors (map #(get-in matrix %) (neighbors (count matrix) [y x]))
bhauman / compiler-options-schema.clj
Last active Aug 8, 2017
A Schema for ClojureScript Options
View compiler-options-schema.clj
(ns cljs.compiler-options-schema
[clojure.spec :as s]
[clojure.string :as string]
;; for initial dev
[clojure.test :refer [deftest is testing]]))
(defn non-blank-string? [x] (and (string? x) (not (string/blank? x))))
(defonce ^:private registry-ref (atom {}))
westc / limitEval.js
Created Mar 16, 2016
Use web workers to limit the amount of time that an eval can run.
View limitEval.js
function limitEval(code, fnOnStop, opt_timeoutInMS) {
var id = Math.random() + 1,
blob = new Blob(
{ type:'text/javascript' }
myWorker = new Worker(URL.createObjectURL(blob));
function onDone() {
shaunlebron / 00-input.cljs
Last active Jun 18, 2016
protocol implementation in cljs
View 00-input.cljs
;; dummy protocol
(defprotocol IFoo
(foo [this]))
;; dummy cljs type
(deftype Bar [])
;; extending a cljs type
(extend-type Bar
IFoo (foo [this] (println "Hello from for Bar")))
patrickhammond /
Last active Aug 7, 2020
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL"
View gist:4136116
;; Example:
;; (doseq-indexed idx [name names]
;; (println (str idx ". " name)
(defmacro doseq-indexed-functional [index-sym [item-sym coll] & body]
`(doseq [[~item-sym ~index-sym]
(map vector ~coll (range))]
You can’t perform that action at this time.