Skip to content

Instantly share code, notes, and snippets.

View HelderFigueiredo's full-sized avatar

Helder Figueiredo HelderFigueiredo

View GitHub Profile
@HelderFigueiredo
HelderFigueiredo / curry.js
Last active February 5, 2018 06:23
Currify a function.
function curry(...args) {
let storedArgs = args.slice(1);
const fn = args[0];
const fnArgsLen = fn.length;
const curriedFn = (...newArgs) => {
let currentArgs = [...storedArgs, ...newArgs];
if (currentArgs.length >= fnArgsLen) {
return fn(...(currentArgs.slice(0, fnArgsLen)));
@HelderFigueiredo
HelderFigueiredo / beautiful_idiomatic_python.md
Created May 28, 2017 15:26 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]: