Skip to content

Instantly share code, notes, and snippets.

@proustibat
proustibat / read-results.sh
Last active May 7, 2018 12:21
read-results.sh
#!/usr/bin/env bash
## @file read-results.sh
## @author Jennifer Proust - proustibat@gmail.com
## @section DESCRIPTION Get all results of install-comparisons.sh script
set -o errexit || true
set -o errtrace
set -o nounset
set -o pipefail
#set -o xtrace
@proustibat
proustibat / install-comparisons.sh
Last active August 13, 2018 03:21
NPM 5 / NPM 6 / Yarn installations
#!/usr/bin/env bash
## @file install-comparisons.sh
## @author Jennifer Proust - proustibat@gmail.com
## @section DESCRIPTION Compare installations times between NPM 5/ NPM6 and YARN
set -o errexit || true
set -o errtrace
set -o nounset
set -o pipefail
#set -o xtrace
@proustibat
proustibat / assets
Created December 25, 2017 20:59
assets
//
@proustibat
proustibat / makeArrayConsecutive2.js
Created December 11, 2017 18:56
Ratiorg got statues of different sizes as a present from CodeMaster for his birthday, each statue having an non-negative integer size. Since he likes to make things perfect, he wants to arrange them from smallest to largest so that each statue will be bigger than the previous one exactly by 1. He may need some additional statues to be able to ac…
const makeArrayConsecutive2 = statues => Math.max( ...statues ) - Math.min( ...statues ) + 1 - statues.length;
@proustibat
proustibat / shapeArea.js
Last active March 3, 2021 06:19
We will define an n-interesting polygon. Your task is to find the area of a polygon for a given n.
const shapeArea = n => Math.pow( n, 2 ) + Math.pow( n - 1, 2 );
@proustibat
proustibat / adjacentElementsProduct.js
Last active December 11, 2017 18:02
Given an array of integers, find the pair of adjacent elements that has the largest product and return that product.
const adjacentElementsProduct = arr => Math.max( ...arr.slice( 1 ).map( ( n, i ) => n * arr[ i ] ) );
function happyNewYear(wish) {
var _arr = wish.match(/\S+\s*/g);
var _startStr = "* ",
_endStr = "*",
_longestLength = wish.match(/\S+\s*/g).sort(function (a, b) { return b.length - a.length; })[0].length,
_lengthToGet = _longestLength + _startStr.length + _endStr.length,
_ref = Array(_lengthToGet).join("*") + _endStr,
_result = [];
for (var i=0, l=_arr.length; i<l; i++) {