Skip to content

Instantly share code, notes, and snippets.

//JSX code
<HBar
// data is an array of {v: 18, label: "Joseph"} objects
data={randomData()}
/>
//CSS
//JSX code
<HBar
data={randomData(9, 10000, true)}
width="230"
height="300"
focus="3" // focus on the 3rd bar
textPosition="dynamic" // insert texts in bars if possible
axis="false"
sort="descending"
//JSX code
<HBar
data={randomData()}
width="230"
height="300"
axis="false"
sort="descending"
formatter={formatter}
//lighten for 150ms an element that appeared or that was reordered. Requires barColor
@laem
laem / autogitignoredrsync.sh
Last active August 29, 2015 14:16
Watch for local changes, exluding according to ./.gitignore, to rsync to $dest
#!/bin/bash
#
# Fork of https://gist.github.com/senko/1154509#file-onchange-sh
if [ -z "$1" ]; then
echo "Specify an rsync dest as first argument"
exit -1;
fi
EVENTS="CREATE,CLOSE_WRITE,DELETE,MODIFY,MOVED_FROM,MOVED_TO"
while true; do free | sed -En "s/.*buffers\/cache:\s+([0-9]+).*/\1/p" >> ~/trounoir/maram; sleep 1; done

sudo docker exec -i -t RUNNING_DOCKER_NAME bash

sudo openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/cozy/server.key -out /etc/cozy/server.crt -days 365 -subj '/CN=DOMAIN_NAME'

(defmacro forever [& body]
`(while true ~@body))
@laem
laem / cljtransducers
Created July 1, 2015 12:54
Clojure transducers
https://news.ycombinator.com/item?id=9808021
No, reducers are about reducing things. Transducers are about creating reducers that can be used on arbitrary collection-like things.
Reducers come from the observation that many higher order operations on collections can be built on reduce. You just supply the right reducing function and you get the equivalent to 'map' or 'filter'. This is useful because when you start chaining these higher order functions you can gain performance be replacing the multiple function calls with a single reducer based function.
To take the example from the main docs:
(fold + (filter even? (map inc [1 1 1 2])))
<script src="https://rawgit.com/sgmap/cout-embauche/gh-pages/dist/cout-embauche-widget.js"></script>
@laem
laem / net->brut.py
Last active January 20, 2016 16:37
import math
from scipy.optimize import fsolve
def calculate_net_from(brut):
print brut[0]
scenario = tax_benefit_system.new_scenario()
scenario.init_single_entity(
period = "2015-11",
parent1 = dict(
age = 30,