Skip to content

Instantly share code, notes, and snippets.

View wasinsandiego's full-sized avatar

Will Schoenberger wasinsandiego

View GitHub Profile
@rocketworm
rocketworm / gherkin.js
Last active August 22, 2023 11:43
SyntaxHighlighter Custom Brush: Gherkin
/**
* Author: Michael Hall
* URL: http://www.bankofcanada.ca/
* License: GPL-2 | GPL-3
*/
SyntaxHighlighter.brushes.Gherkin = function()
{
/**
* Filters out the delimiters and values out of tables.
* @param match: the contents of the matching text
@rkrupinski
rkrupinski / curry.js
Created October 7, 2016 06:05
Currying with generators
function* curryGen(fn) {
const l = fn.length;
const args = [];
while (true) {
if (args.length < l) {
args.push(...yield);
} else {
return fn(...args);
}

Important: At the time of writing (2019-11-11) Immutable.js is effectively abandonware, so I can no longer recommend anyone to follow the advice given here. I'll leave the article here for posterity, since it's still getting some traffic.

Understanding Immutable.Record

Functional programming principles and with it immutable data are changing the way we write frontend applications. If the recent de-facto frontend stack of React and Redux feels like it goes perfectly together with immutable data, that's because it's specifically designed for that.

There's several interesting implementations of immutable data for JavaScript, but here I'll be focusing on Facebook's own Immutable.js, and specifically on one of i

@mikepea
mikepea / pr_etiquette.md
Last active July 7, 2024 16:11
Pull Request Etiquette

Pull Request Etiquette

Why do we use a Pull Request workflow?

PRs are a great way of sharing information, and can help us be aware of the changes that are occuring in our codebase. They are also an excellent way of getting peer review on the work that we do, without the cost of working in direct pairs.

Ultimately though, the primary reason we use PRs is to encourage quality in the commits that are made to our code repositories

Done well, the commits (and their attached messages) contained within tell a story to people examining the code at a later date. If we are not careful to ensure the quality of these commits, we silently lose this ability.

@domenic
domenic / promises.md
Last active June 24, 2024 03:11
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.
@kputnam
kputnam / u.js
Created July 12, 2012 23:46
Functional combinators in JavaScript
var u = (function() {
var id = function(x) { return x; }
, single = function(x) { return [x]; }
, constant = function(x) { return function() { return x; }};
var curried = function(f, n, args) {
return (args.length >= n)
? f.apply(null, args)
: function() { return curried(f, n, args.concat(slice(arguments))); }; };