I hereby claim:
- I am joelnet on github.
- I am joelnet (https://keybase.io/joelnet) on keybase.
- I have a public key ASBhE_5H8aJ_C-JIpSwxrk42nUN2c1I_f0Fe6jmlWphKhgo
To claim this, I am signing this object:
// Y Combinator | |
const Y = a => (b => b (b)) (b => a (c => b (b) (c))) | |
// isomorphic Church encoding/decoding | |
const Church = { | |
to: n => f => x => Array.from (Array (n)).reduce (f, x), | |
from: f => f (x => x + 1) (0) | |
} | |
const True = a => b => a |
const renamed = ({ ID, ...object }) => ({ id: ID, ...object }) | |
const user = { | |
ID: 500, | |
name: "Bob Fossil" | |
} | |
renamed(user) //=> { id: 500, name: 'Bob Fossil' } |
const user = { id: 100, name: 'Howard Moon' } | |
const password = 'Password!' | |
const userWithPassword = { | |
...user, | |
id: 100, | |
...(password && { password }) | |
} | |
userWithPassword //=> { id: 100, name: 'Howard Moon', password: 'Password!' } |
const user2 = { | |
id: 200, | |
name: 'Vince Noir' | |
} | |
const user4 = { | |
id: 400, | |
name: 'Bollo', | |
quotes: ["I've got a bad feeling about this..."] | |
} |
const user1 = { | |
id: 100, | |
name: 'Howard Moon', | |
password: 'Password!' | |
} | |
const removeProperty = prop => ({ [prop]: _, ...rest }) => rest | |
// ---- ------ | |
// \ / | |
// dynamic destructuring |
const noPassword = ({ password, ...rest }) => rest | |
const user = { | |
id: 100, | |
name: 'Howard Moon', | |
password: 'Password!' | |
} | |
noPassword(user) //=> { id: 100, name: 'Howard moon' } |
Choose a ticket class: <select id="tickets"></select> | |
<p id="ticketOutput"></p> | |
<script id="ticketTemplate" type="text/x-jquery-tmpl"> | |
{{if chosenTicket}} | |
You have chosen <b>${ chosenTicket().name }</b> | |
($${ chosenTicket().price }) | |
<button data-bind="click: resetTicket">Clear</button> | |
{{/if}} |
const pipe = require('ramda/src/pipe') | |
const curry = require('ramda/src/curry') | |
const clampA = (min, max, value) => { | |
let newValue = Number(value) | |
newValue = Math.min(max, newValue) | |
newValue = Math.max(min, newValue) | |
return newValue | |
} |
I hereby claim:
To claim this, I am signing this object:
/** | |
* Demo for https://twitter.com/joelnet/status/1163820524709076992 | |
*/ | |
class Person { | |
constructor(firstName, lastName) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
} | |
} |