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
$ python3 - a b c | |
Python 3.6.8 (v3.6.8:3c6b436a57, Dec 24 2018, 02:04:31) | |
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import sys | |
>>> sys.argv | |
['-', 'a', 'b', 'c'] | |
>>> sys.argv = [sys.argv[0]] | |
>>> sys.argv | |
['-'] |
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
/** | |
* eg: | |
* { __createdAt: 'monday', order_id: 123, some_field_: 'abc' } => | |
* { createdAt: 'monday', orderId: 123, someField: 'abc' } | |
*/ | |
function convertPropertyNamesToCamelCase(object) { | |
const newObject = {}; | |
_.mapKeys(object, (value, prop) => { | |
const newProp = prop |
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
:active | |
additive-symbols | |
(@counter-style) | |
::after | |
(:after) | |
align-content | |
align-items | |
align-self | |
all | |
<an-plus-b> |
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
const winston = require('winston'); | |
const { join, basename, dirname } = require('path'); | |
const fs = require('fs'); | |
const logform = require('logform'); | |
// const { MESSAGE } = require('triple-beam'); // prop for info in winston formater to expose the shown message | |
function filterMessagesFormat(filterFunc = () => true) { | |
const formatFunc = (info) => { | |
if (filterFunc(info.message)) return info; | |
return null; |
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
function timeIt(func) { | |
return async (...args) => { | |
const start = new Date(); | |
const output = await func(...args); | |
console.log(`${func.name} took ${(new Date() - start) / 1000} s`); | |
return output; | |
} | |
} |
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
[ | |
"b", | |
"b", | |
"b", | |
"b", | |
"b", | |
"b", | |
"b", | |
"b", | |
"b", |
This file has been truncated, but you can view the full file.
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
[ | |
[ | |
2, | |
1, | |
1, | |
1, | |
6, | |
6, | |
3, | |
2, |
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
export $(grep -v '^#' .env | xargs) |
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
const _ = require('lodash'); | |
const checkWords = require('check-word'); | |
const englishWords = checkWords('en'); | |
/** | |
* | |
* @param character {string} | |
* @returns {boolean} | |
*/ | |
function isUpper(character) { |
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
const fs = require('fs'); | |
function toCsv(arrayOfObjects) { | |
let getProps = (object) => { | |
return Object.getOwnPropertyNames(object); | |
}; | |
let props = getProps(arrayOfObjects[0]); | |
let outputString = props.join(',') + '\n'; |
NewerOlder