Skip to content

Instantly share code, notes, and snippets.

// Compare two arrays(primary and secondary) and return all array items that are unique to the primary array
const getDiff = (primaryArray, secondaryArray) => {
return primaryArray.filter(item => secondaryArray.indexOf(item) === -1);
};
// getDiff([1, 2, 3, 5], [1, 3, 4])
// => [2, 5]
import { createRequest } from 'request-state-wrapper';
const getRepoDetails = () =>
fetch('https://api.github.com/repos/nodejs/node').then(response => response.json());
// Create your request with request-state-wrapper
const request = createRequest({
request: getRepoDetails,
stalledDelay: 1000,
onStalled: () => { /* handle stalled state */ },
const getNodeRepoDetails = () =>
fetch('https://api.github.com/repos/nodejs/node').then(response => response.json());
const getGoRepoDetails = () =>
fetch('https://api.github.com/repos/golang/go').then(response => response.json());
Promise.all([getNodeRepoDetails(), getGoRepoDetails()])
.then(response => {
const [ nodeResponse, goResponse ] = response;
/* handle request response */
import { createRequest } from 'request-state-wrapper';
const getNodeRepoDetails = () =>
fetch('https://api.github.com/repos/nodejs/node').then(response => response.json());
const getGoRepoDetails = () =>
fetch('https://api.github.com/repos/golang/go').then(response => response.json());
const request = createRequest({
request: [getNodeRepoDetails, getGoRepoDetails],
const createURL = (baseURL, path) => {
const protocol = "https";
return `${protocol}://${baseURL}/${path}`;
};
// create URLs for our main site
const homeURL = createURL("mysite.com", "");
const loginURL = createURL("mysite.com", "login");
const productsURL = createURL("mysite.com", "products");
const contactURL = createURL("mysite.com", "contact-us");
const createURL = baseURL => {
const protocol = "https";
// we now return a function, that accepts a 'path' as an argument
return path => {
return `${protocol}://${baseURL}/${path}`;
};
};
// we create a new functions with the baseURL value in it's closure scope
// given a database of global parcels like this...
const allGlobalParcels = [
{
created: 576424800000,
location: "aus",
properties: { ... },
},
{
created: 1558163267311,
location: "us",
// given a database of global parcels like this...
const allGlobalParcels = [
{
created: 576424800000,
location: "aus",
properties: { ... },
},
{
created: 1558163267311,
location: "us",

Some principles and techniques I use in my teams at the moment. I hope these could be helpful for Technical Leads or Product Owners.

Addressing challenges with estimating

Software engineers enjoy solving problems with code. They value understanding why the thing they are working on is important.

For almost all non-trivial tasks, the full scope of dependencies, technical limitations and edge cases only reveal themselves during the development process. For this reason, I try to make the initial planning light touch and focus on the problem to solve. Accepting that we will start the development process before knowing everything can make estimating difficult. Forcing engineers to commit to specific estimates makes them feel that they cannot modify their approach if they learn something through the process of doing. Here are some reasons engineers can struggle with estimating and what can be done to help.

Estimating work that has too many unknowns