Skip to content

Instantly share code, notes, and snippets.

View mpenet's full-sized avatar
🪲
breeding bugs

Max Penet mpenet

🪲
breeding bugs
View GitHub Profile
@lynaghk
lynaghk / 0-update.md
Last active July 5, 2022 13:33
Angular.js from ClojureScript
@tonymorris
tonymorris / TypeClass.hs
Last active September 15, 2020 13:17
Type-class hierarchy
Moved to https://github.com/tonymorris/type-class
@domenic
domenic / promises.md
Last active April 1, 2025 01:54
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.
@teohm
teohm / gist:4343392
Created December 20, 2012 06:55 — forked from headius/gist:4343186
system ~/projects/jruby/blah $ jruby ../../startup_bench/lib/tune.rb 1 'touch Gemfile.lock && rm Gemfile.lock && jruby -S bundle install --quiet --local'
Beginning tuning for `touch Gemfile.lock && rm Gemfile.lock && jruby -S bundle install --quiet --local`
Trying 90 combinations of flags
--------------------------------------------------------------------------------
Last: -J-server
Average time: 8.529s
Overall average: 8.529s
Estimated completion time: 2012-12-19 23:46:27 -0600
--------------------------------------------------------------------------------
Last: -J-client
(ns net.cgrand.decay
"Exponentially decaying lists. See http://awelonblue.wordpress.com/2013/01/24/exponential-decay-of-history-improved/
for background and http://clj-me.cgrand.net/2013/02/12/decaying-lists-log-scale-for-lists/ for documentation")
;; PRNG, formulas straight from java.util.Random javadoc
(defn- seed ^long [^long n]
(bit-and (unchecked-multiply n 0x5DEECE66D)
(unchecked-dec (bit-shift-left 1 48))))
(defn- next-seed ^long [^long seed]
@joelittlejohn
joelittlejohn / find-unused-clj.sh
Last active November 6, 2020 16:56
Very quick and dirty command to find unused functions and vars in a Clojure project
#!/bin/bash
for f in $(egrep -o -R "defn?-? [^ ]*" * --include '*.clj' | cut -d \ -f 2 | sort | uniq); do
echo $f $(grep -R --include '*.clj' -- "$f" * | wc -l);
done | grep " 1$"
@frenchy64
frenchy64 / kw.clj
Created April 11, 2013 16:02
core.typed keyword parameters
(ns clojure.core.typed.test.kw-args
(:require [clojure.core.typed :refer [ann check-ns ann-form cf]]
[clojure.tools.analyzer :refer [ast]]
[clojure.tools.analyzer.emit-form :refer [emit-form]]))
(ann foo-kw [& {:a Number} -> (U nil Number)])
(defn foo-kw [& {:keys [a]}]
(when a
(inc a)))
@daveray
daveray / astyanax-clj.clj
Last active December 16, 2015 16:40
astyanax clojure binding docs
; will open source in the near future. feedback/questions welcome.
(ns com.netflix.astyanax
"Clojure bindings for Cassandra via Astyanax
# Serializers
Serializer, when used in schemas (see below) are typically specified with a keyword.
The following are available, corresponding to the Astyanax serializers of the same
name:
:ascii, :big-integer, :boolean, :bytes, :char, :date, :double, :float, :integer
(ns create-draw.opencv
(:import
org.opencv.core.Core
org.opencv.core.Mat
org.opencv.core.MatOfRect
org.opencv.core.Point
org.opencv.core.Rect
org.opencv.core.Scalar
org.opencv.highgui.Highgui
org.opencv.objdetect.CascadeClassifier))
# coding=UTF-8
import nltk
from nltk.corpus import brown
# This is a fast and simple noun phrase extractor (based on NLTK)
# Feel free to use it, just keep a link back to this post
# http://thetokenizer.com/2013/05/09/efficient-way-to-extract-the-main-topics-of-a-sentence/
# Create by Shlomi Babluki
# May, 2013