made with esnextbin
This file contains hidden or 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 off | |
echo Administrative permissions required. Detecting permissions... | |
net session >nul 2>&1 | |
if %errorLevel% == 0 ( | |
echo Success: Administrative permissions confirmed. | |
) else ( | |
echo Failure: Current permissions inadequate. | |
pause | |
exit 1 |
This file contains hidden or 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
// This mixin might be used to extend a class with or without its | |
// own "foo" method | |
const mixin = Base => class extends Base { | |
foo() { | |
// Only call super.foo() if it exists! | |
if (super.foo) { | |
super.foo(); | |
} | |
console.log('mixin'); |
This file contains hidden or 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
// npm install && npm run build | |
// In output.js, spreadTest(...args) is converted to ES5 | |
function spreadTest(...args) { | |
return args; | |
} | |
console.log(spreadTest(1, 2, 3)); | |
// But the ...args inside of this lib's "audit" function is NOT converted to ES5 | |
import 'react-axe'; |
made with esnextbin
This file contains hidden or 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
this.OnClickOutside = this.onClickOutside; |
This file contains hidden or 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
// This function returns 2 separate values via an object with 2 properties. | |
function returnTwoValuesObj(str) { | |
const length = str.length; | |
const hasSpaces = str.indexOf(' ') !== -1; | |
return {length, hasSpaces}; | |
} | |
// This function returns 2 separate values via an array (effectively a tuple) with 2 items. | |
function returnTwoValuesTuple(str) { | |
const length = str.length; |
This file contains hidden or 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
-- This is the result I want: | |
-- | |
-- foo | bar | description | |
-- -----+-----+------------- | |
-- 3 | 4 | two | |
-- 1 | 2 | four | |
-- 5 | 6 | five | |
-- | |
-- Which I can get with this query, but can I do it | |
-- more simply? |
This file contains hidden or 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
import Promise from 'bluebird'; | |
function getBatches(arr, length) { | |
let i = 0; | |
const result = []; | |
while (i < arr.length) { | |
result.push(arr.slice(i, i + length)); | |
i += length; | |
} | |
return result; |