- Few: 1-4
- Several: 5-9
- Pack: 10-19
- Lots: 20-49
- Horde: 50-99
- Throng: 100-249
- Swarm: 250-499
- Zounds: 500-999
- Legion: 1000+
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const firstIndexOf = ( c, ...vars ) => Math.min( ...vars.map( v => c.indexOf( v ) ).filter( n => n > -1 ) ); | |
const lastIndexOf = ( c, ...vars ) => Math.max( ...vars.map( v => c.lastIndexOf( v ) ) ); | |
utfString.split( '\0ustar' ).slice( 1 ).map( c => | |
c.substring( firstIndexOf( c, '{', '[' ), lastIndexOf( c, '}', ']' ) + 1 ) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
small01.json������������������������������������������������������������������������������������� | |
���000644 �000766 �000024 �00000000050 13470047041 015217� 0������������������������������������� | |
���������������������������������������������������������������ustar�00stefanozanata������������� | |
������staff���������������������������000000 �000000 �������������������������������������������� | |
������������������������������������������������������������������������������������������������� | |
���������������������������{ | |
"_id": "5ce04968bec07cf2a356f789" | |
} | |
������������������������������������������������������������������������������������������������� | |
������������������������������������������������������������������������������������������������� |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { unzipSync } = require( 'zlib' ); | |
unzipSync( raw ).toString( 'utf-8' ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { unzipSync } = require( 'zlib' ); | |
const firstIndexOf = ( c, ...vars ) => Math.min( ...vars.map( v => c.indexOf( v ) ).filter( n => n > -1 ) ); | |
const lastIndexOf = ( c, ...vars ) => Math.max( ...vars.map( v => c.lastIndexOf( v ) ) ); | |
/** | |
* Decompress JSON | |
* | |
* Reads a gzipped tarball (.tar.gz) | |
* 1. Unzip it |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Starting docker" | |
:: Some references | |
:: https://github.com/docker/for-win/issues/969 | |
:: https://forums.docker.com/t/volume-mounts-in-windows-does-not-work/10693/25 | |
set /p PWD="Enter your user password: " | |
DOMAIN="your compute name" | |
USERNAME="your username" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const personnel = [ | |
{ | |
id: 5, | |
name: "Luke Skywalker", | |
pilotingScore: 98, | |
shootingScore: 56, | |
isForceUser: true, | |
}, | |
{ | |
id: 82, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const format = time => [ time, 3600000, 60000, 1000, 1 ] | |
.reduce( ( parts, d, i, arr ) => { | |
if ( i === 0 ) { return parts; } | |
const p = Math.floor( arr[0] / d ); | |
arr[0] = arr[0] - (p * d); | |
return parts.concat( p ); | |
}, [] ).map( t => String( t ).padStart( 2, '0' ) ).join(':'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sizeLimit = 1000000; | |
const lengthLimit = 500; | |
const getSize = obj => Buffer.byteLength( JSON.stringify( obj ) ); | |
const isUnderLimits = batch => batch.length <= lengthLimit && getSize( batch ) <= sizeLimit; | |
module.exports = records => records.reduce( ( batches, record ) => { | |
if ( isUnderLimits( [].concat( batches[0], record ) ) ) { | |
batches[0].push( record ); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deepFetch( object, path ) { | |
return path.split( '.' ).reduce( ( value, part ) => { | |
if ( Array.isArray( value ) ) { | |
return value.reduce( (arr, v) => arr.concat( deepFetch( v, part ) ), [] ); | |
} else if ( part === '*' ) { | |
return Object.keys( value ).map( p => value[p] ); | |
} | |
return value[part]; | |
}, object ); | |
} |
NewerOlder