Skip to content

Instantly share code, notes, and snippets.

View nybblr's full-sized avatar
🌱
I help developers craft their best work, achieve goals, and never stop growing.

Jonathan Lee Martin nybblr

🌱
I help developers craft their best work, achieve goals, and never stop growing.
View GitHub Profile
@nybblr
nybblr / google-sheets.js
Created January 22, 2018 22:43
Google sheets functions for meetup
function getCost(cell) {
return cell.match(/\$[\d.,]+\d/)[0]
}
function getCondition(cell) {
return cell.match(/((like )?new|used|mint|good|great|excellent)/i)[0]
}
function getEmail(cell) {
return (cell.match(/[^\s@]+@[^\s@]+/i) || ['N/A'])[0]
@nybblr
nybblr / concat.js
Created August 30, 2018 15:15
Playing around with ES2015 Proxy to make an array from two others — without copying! i.e. Array Trie.
const intRegex = /^(0|[1-9]\d*)$/;
let isIndex = prop =>
typeof prop === 'string'
&& intRegex.test(prop);
let concat = (left, right) => {
let w = left.length;
let h = right.length;
@nybblr
nybblr / async-generator.js
Last active January 19, 2019 02:16
Tiny example of async generator functions
let timer = (ms) => new Promise(resolve => setTimeout(resolve, ms));
let producer = async function*() {
let counter = 0;
while (true) {
let delay = Math.random() * 1000;
await timer(delay);
yield counter++;
}
};