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
// Read line by line from a file. | |
const fs = require('fs'); | |
const readline = require('readline'); | |
const stream = require('stream') | |
function processFile(inputFile) { | |
const instream = fs.createReadStream(inputFile); | |
const outstream = new (stream)(); | |
const rl = readline.createInterface(instream, outstream); | |
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
console.log('\x1b[36m%s\x1b[0m', 'I am cyan', '\x1b[0m'); //cyan | |
console.log('\x1b[33m%s\x1b[0m', stringToMakeYellow, '\x1b[0m'); //yellow | |
// Colors reference | |
// Reset = "\x1b[0m" | |
// Bright = "\x1b[1m" |
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
************************************************************ | |
the helper function | |
************************************************************ | |
const tryCatch = (func) => (req, res, next) => { | |
try { | |
await func(req, res, next); | |
} catch (err) { | |
next(err); | |
} | |
}; |
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
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Launch Program", | |
"program": "${workspaceFolder}/app.js", | |
"protocol": "inspector", | |
"runtimeExecutable": "nodemon", | |
"restart": true | |
} |
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 command removes all local branches which have already been merged into a main branch | |
git branch --merged | egrep -v "(^\*|master|development|test)" | xargs git branch -d | |
extra info found here: https://stackoverflow.com/questions/6127328/how-can-i-delete-all-git-branches-which-have-been-merged |
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
// jasmine only: | |
{ | |
"name": "Tests", | |
"type": "node", | |
"protocol": "inspector", | |
"request": "launch", | |
"program": "${workspaceRoot}/node_modules/jasmine/bin/jasmine.js", | |
"stopOnEntry": false, | |
"args": [], | |
"cwd": "${workspaceRoot}", |
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 a helper script that can be used to recursively insert an | |
angular import statement into all .ts files in a given directory. | |
call: | |
node renamer <directory> | |
*/ | |
var fs = require('fs'); | |
var path = require('path'); | |
var linesert = require( "linesert" ); |
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 a helper script that can be used to recursively rename all | |
JavaScript files within a given directory into TypeScript files. | |
call: | |
node renamer <directory> | |
*/ | |
var fs = require('fs'); | |
var path = require('path'); | |
var ANSI_GREEN = '\x1b[32m'; |