Skip to content

Instantly share code, notes, and snippets.

View r-k-b's full-sized avatar

Robert K. Bell r-k-b

View GitHub Profile

The Why and When of Choosing Elm

What is Elm?

  • Language (and "framework") for building web frontend applications
  • Can be used in place of HTML, CSS and JavaScript
  • Compiles into the above
@SIRHAMY
SIRHAMY / gtltexample.html
Created September 18, 2016 04:49
React/JSX: Put greater than and less than symbol in HTML
<div>{"<"} Less than, {">"} greater than </div>
@DrBoolean
DrBoolean / reports.js
Created August 23, 2016 16:21
Curry use
// to, from are awkward here. generateReport only needs them to send an email
const generateReport = (to, from, data) =>
mungeData(data, (warnings, munged) =>
renderReport(munged, (report) => emailReport(to, from, report)))
generateReport(“info@reports.com”, “app@test.net”, {some: ‘data’})
// if emailReport was curried, we could pass in the emailer
@ericelliott
ericelliott / broken-instanceof.js
Created June 1, 2016 05:24
instanceof doesn't mean what you think it means...
// instanceof is a prototype identity check.
// NOT a type check.
// That means it lies across execution contexts,
// when prototypes are dynamically reassigned,
// and when you throw confusing cases like this
// at it:
function foo() {}
const bar = { a: 'a'};
@Avaq
Avaq / combinators.js
Last active March 18, 2024 20:49
Common combinators in JavaScript
const I = x => x
const K = x => y => x
const A = f => x => f (x)
const T = x => f => f (x)
const W = f => x => f (x) (x)
const C = f => y => x => f (x) (y)
const B = f => g => x => f (g (x))
const S = f => g => x => f (x) (g (x))
const S_ = f => g => x => f (g (x)) (x)
const S2 = f => g => h => x => f (g (x)) (h (x))
@Su-Shee
Su-Shee / gist:5d1a417fa9de19c15477
Last active April 12, 2024 11:27
Falsehoods Programmers Believe About "Women In Tech"

Falsehoods Programmers Believe About "Women In Tech"

  • We have absolutely no idea what we're doing in tech. Please explain the utmost basic things to us.

  • We only do web design. Our whole reason of being in tech is to make things pretty. Consider us the doilies of the industry.

  • We're not laughing about your joke, so we clearly need you explain it to us. In great detail.

  • We're only in tech to find a husband, boyfriend or generally to get laid.

@cjaoude
cjaoude / gist:fd9910626629b53c4d25
Last active April 4, 2024 18:17
Test list of Valid and Invalid Email addresses
Use: for testing against email regex
ref: http://codefool.tumblr.com/post/15288874550/list-of-valid-and-invalid-email-addresses
List of Valid Email Addresses
email@example.com
firstname.lastname@example.com
email@subdomain.example.com
firstname+lastname@example.com
@raine
raine / heroku-logs-with-bunyan.md
Last active August 3, 2018 19:14
Read heroku log output with bunyan

Read heroku logs output w/ bunyan

The stuff before the JSON in heroku logs output has to be cut off for bunyan to work.

$ heroku logs | sed -l 's/.*app\[web\..*\]\: //' | bunyan

Flag -l makes the output buffered by line.

@donnut
donnut / currying.md
Last active October 28, 2023 17:58
TypeScript and currying

TypeScript and currying

In functional programming you often want to apply a function partly. A simple example is a function add. It would be nice if we could use add like:

var res2 = add(1, 3); // => 4

var add10To = add(10);
var res = add10To(5); // => 15
@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing