Skip to content

Instantly share code, notes, and snippets.

View michael-lefebvre's full-sized avatar

Michael Lefebvre michael-lefebvre

View GitHub Profile
const chunk = (arr, chunkSize, cache = []) => {
const tmp = [...arr];
if (chunkSize <= 0) return cache;
while (tmp.length) cache.push(tmp.splice(0, chunkSize));
return cache;
};
const trimBasename = (path) => path;
const normalizeSlashes = (path) => path.replace(/\/\/+/g, '/');
const splitPath = (path) =>
normalizeSlashes(path).split('/').filter(Boolean)

Keybase proof

I hereby claim:

  • I am michael-lefebvre on github.
  • I am michaellefebvre (https://keybase.io/michaellefebvre) on keybase.
  • I have a public key ASAC4r-DKMXVdg6snb0amy35fYfmgRgFb7JPm_B8Xa3cRgo

To claim this, I am signing this object:

@michael-lefebvre
michael-lefebvre / DotNotation.php
Created November 4, 2015 23:41 — forked from antonmedv/DotNotation.php
Dot notation for access multidimensional arrays.
<?php
/**
* Dot notation for access multidimensional arrays.
*
* $dn = new DotNotation(['bar'=>['baz'=>['foo'=>true]]]);
*
* $value = $dn->get('bar.baz.foo'); // $value == true
*
* $dn->set('bar.baz.foo', false); // ['foo'=>false]
*