Skip to content

Instantly share code, notes, and snippets.

@channie
channie / email-notes.txt
Last active September 25, 2015 21:51
Email Notes
Styleguide: Email related styleguide is in the ns-email branch:
https://github.com/change/styleguide/tree/ns-emails
email_templates.en-US.yml -- This is the file where English phrases used in emails are stored, so
that they can be pulled into OneSky and translated.
Action Alert Emails:
Action alert emails are emails that call for an action, such as signing or starting petition.
Historically they're sent by campaigners (representing Change); as Change.org platform grows,
@channie
channie / functional_programming_note_examples_ch4-6.txt
Created February 25, 2019 00:32
Functional programming notes and examples (ch.4-6)
CURRY
Definition from Lodash _.curry(func, [arity=func.length]):
Creates a function that accepts arguments of func and either invokes func returning its result, if at least arity number of arguments have been provided, or returns a function that accepts the remaining func arguments, and so on.
currying => partially applying functions
Example:
const match = curry((what, s) => s.match(what));
const hasLetterR = match(/r/g);
Q from last week: Why Lodash uses "flow" instead of "compose"?
Lodash v1 and v2 have _.compose
In Lodash v3, _.compose is equal to _.flowRight
In Lodash v4, _.compose no longer exists. There are only _.flow and _.flowRight
The Lodash _.compose's concept is that it composes functions f(), g(), h() as f(g(h())),
so it's a _.flowRight where the order of functions executed are from left to right, unlike
the generic "compose" concept of right to left.