Skip to content

Instantly share code, notes, and snippets.

@pmclanahan
pmclanahan / pre-commit
Created May 23, 2014 23:01
Flake8 and jshint pre-commit git hook
#!/bin/sh
exit_code=0
for file in `git diff --cached --name-only --diff-filter=ACM | sort | uniq`
do
if [ ${file: -3} == ".py" ]; then
flake8 --ignore=E121,E123,E124,E125,E126,E127,E128,E501 $file
if [ "$?" -ne "0" ]; then
exit_code=1
@staltz
staltz / introrx.md
Last active May 30, 2024 01:44
The introduction to Reactive Programming you've been missing
(Chapters marked with * are already written. This gets reorganized constantly
and 10 or so written chapters that I'm on the fence about aren't listed.)
Programmer Epistemology
* Dispersed Cost vs. Reduced Cost
* Verificationist Fallacy
* Mistake Metastasis
The Overton Window
Epicycles All The Way Down
The Hyperspace Gates Were Just There
@john2x
john2x / 00_destructuring.md
Last active May 29, 2024 00:25
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

@oubiwann
oubiwann / 01-bottle.py
Last active August 29, 2015 14:05
Comparison of Python (Bottle), Clojure (Compojure), and Erlang/LFE (lfest) REST Routes
from example.bottle.bttl import Bottle
app = Bottle()
@app.get('/')
def index():
return "Hello, World!"
@app.get('/orders')
def get_orders():
@mikekap
mikekap / gist:640f7908e3f7c08ce3f6
Last active November 4, 2016 03:25
CFFI PCRE Implementation
from __future__ import unicode_literals
from cffi import FFI
from collections import OrderedDict
import string
import sys
assert sys.maxunicode == 0x10FFFF
ffi = FFI()
@kachayev
kachayev / concurrency-in-go.md
Last active March 11, 2024 11:27
Channels Are Not Enough or Why Pipelining Is Not That Easy
[Unit]
Description=cAdvisor Service
After=docker.service
Requires=docker.service
[Service]
Restart=always
ExecStartPre=-/usr/bin/docker kill cadvisor
ExecStartPre=-/usr/bin/docker rm -f cadvisor
ExecStartPre=/usr/bin/docker pull google/cadvisor
ExecStart=/usr/bin/docker run --name cadvisor --volume=/var/run:/var/run:rw --volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:ro --publish=4194:4194 google/cadvisor --logtostderr --port=4194
@rbranson
rbranson / gist:03d88e3733c6ee098a89
Last active July 25, 2017 15:17
My Thoughts on Rust

Rust is the first language that has emerged in the past few years that solves enough of my problems that it would be worth not only learning & teaching an entirely new language, but also sacrificing the maturity of the language ecosystems I’ve become accustomed to.

I highly suggest you read the "Guide" provided by the language developers or this won't make much sense. These are just some of my thoughts and are intended to highlight particular things that stand out to me. I am just a practitioner and not an expert in any of these languages, so I have probably made some incorrect assumptions and out-of-date assertions. Bare with me.

Rust feels like the first time momentum has gained behind a true systems programming language that uses modern PL design techniques to prevent common errors when dealing with memory. It seems like others have previously either been too anemic to be worth adopting or too abstract to provide proper control. The type system and assignment semantics are designed specifically to preven

@erikvold
erikvold / jpm.travis.yml
Last active August 29, 2015 14:07
removing an unecessary line
language: node_js
node_js:
- "0.10"
before_install:
- "export DISPLAY=:99.0"
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16 -extension RANDR"
before_script:
- npm install jpm -g