Skip to content

Instantly share code, notes, and snippets.

View kylefeng's full-sized avatar

Kyle Feng kylefeng

  • Guiyang, Guizhou, China
View GitHub Profile
@yogthos
yogthos / clojure-beginner.md
Last active May 6, 2024 08:11
Clojure beginner resources

Introductory resources

@disq
disq / gcd.sh
Last active January 2, 2017 07:46
gcd: cd in GOPATH
# Put this in ~/.bash_profile
# https://gist.github.com/disq/42459b522836b25f30469b3acb5500bf
gcd() {
if [[ "$1" == "" || "$2" != "" ]]; then
echo "Usage: gcd <dir in gopath>"
return 1
fi
FINDIN=${GOPATH}/src
@john2x
john2x / 00_destructuring.md
Last active April 23, 2024 13:18
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.

Vectors and Sequences

@danneu
danneu / golang-vs-clojure-async.md
Last active November 6, 2023 04:09
Google I/O 2012 - Go Concurrency Patterns ported to Clojure Video: http://www.youtube.com/watch?v=f6kdp27TYZs
(require '[clojure.core.async :as async :refer :all])
(defn fake-search [kind]
(fn [query]
(Thread/sleep (int (* (java.lang.Math/random) 1000)))
(str kind " result for " query)))
(def web (fake-search "Web"))
(def image (fake-search "Image"))
(def video (fake-search "Video"))
(ns monads
(:require clojure.set))
(declare ^:dynamic return
^:dynamic bind)
(defn lift-inc [v]
(return (inc v)))
(defn m-add [mv n]
@jasonrudolph
jasonrudolph / git-branches-by-commit-date.sh
Created February 12, 2012 20:40
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r