Skip to content

Instantly share code, notes, and snippets.

View kepta's full-sized avatar
🐒
What

Kushan Joshi kepta

🐒
What
  • Toronto
View GitHub Profile
const arrayAddFirst = (a, b) => [a, ...b];

In this article I will take a very simplistic approach in understanding memory leaks and I will also attempt to diagnose them.

In todays world of abundant memory, we seldom worry about memory leakages. But I hate to tell you that we live in a real world and nothing comes for free.

Oh my fancy functional programming

Disclosure: I absolutely love functional programming. Functional programming is cool and with the new ES6 syntax it becomes even cooler.

function firstItem([first, second] = ['luke', 'skywalker']) {
return first;
}
function findName({ name } = { name : 'darth' }) {
return name;
}
const isRequired = () => { throw new Error('param is required'); };
function filterEvil(array, evil = isRequired()) {
return array.filter(item => item !== evil);
}
function whoIsEvilNow() {
if (time > 2014) {
return 'J. J. Abrams'
}
return 'darth vader';
}
function findEvil(array, evil = whoIsEvilNow()) {
return array.find(item => item === evil);
}
@kepta
kepta / def_par6.js
Last active November 19, 2017 09:01
function findEvil(array, evil = 'darth vader', respect = 'Bad ' + evil) {
if (array.find(item => item === evil)) {
return respect;
}
}
findEvil(list); // Bad darth vader;
findEvil(list, 'luke'); // Bad luke;
const list = [ 'luke', 'leia', 'darth vader' ];
filterEvil(list, null); // [ 'luke', 'leia', 'darth vader' ]
function filterEvil(array, evil = 'darth vader') {
return array.filter(item => item !== evil);
}
@kepta
kepta / def_param_1.js
Created November 19, 2017 07:39
default_param_1
function filterEvil(array, evil) {
evil = evil || 'darth vader';
return array.filter(item => item !== evil);
}
@kepta
kepta / osm-edit-report-diary.md
Last active March 25, 2017 15:56
osm-edit-report-diary.md

What's cooking at Mapbox this week

As a part of our data transparency efforts at Mapbox. We created osm-edit-report which helps anyone visualize our teams contribution to OSM.

Just to give a measure, the data team added 0.3 Million objects, 0.2 Million tags and 3 thousand changesets last week.

This is how the numbers look:

objects-created