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
{ | |
// Place your snippets for TypeScript React here. Each snippet is defined under a snippet name and has a prefix, body and | |
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
// same ids are connected. | |
// Example: | |
"New TSX FILE": { | |
"prefix": "itsx", | |
"body": [ | |
"import * as React from \"react\";", |
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
brew install emojify | |
alias glog="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --color | emojify | less -r" |
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
let data = "Charge Time,Customer Name,Customer Ref,Amount,Bank Ref,Customer Notes,Topup Number,Status,Operator,Comfirm Type"; | |
records.forEach(record => { | |
data += `\n${getDate( | |
record.transTime * 1000 | |
)},${record.customerName},${record.customerRef},${(record.amount / 100).toFixed( | |
2 | |
)},${record.bankRef},${record.extral.replace( | |
",", | |
"" | |
)},${record.topupNumber},${record.confirmStatus},${record.operator},${record.confirmType}`; |
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
var request = require('request'); | |
var express = require('express'); | |
var app = express(); | |
app.get('/goofy', function(req, res) { | |
request('http://images1.wikia.nocookie.net/__cb20120715102950/disney/images/a/a5/Disneygoofy2012.jpeg').pipe(res); | |
}); | |
app.get('/loop', function(req, res) { | |
res.render('mypage'); |
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
node --max-old-space-size=1024 my-node-script.js #increase to 1gb | |
node --max-old-space-size=2048 my-node-script.js #increase to 2gb | |
node --max-old-space-size=3072 my-node-script.js #increase to 3gb | |
node --max-old-space-size=4096 my-node-script.js #increase to 4gb | |
node --max-old-space-size=5120 my-node-script.js #increase to 5gb | |
node --max-old-space-size=6144 my-node-script.js #increase to 6gb | |
node --max-old-space-size=7168 my-node-script.js #increase to 7gb | |
node --max-old-space-size=8192 my-node-script.js #increase to 8gb |
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
/** | |
* Object.omit | |
* | |
* Returns a (shallow) copy of an object, with specified keys omitted. | |
* | |
* @param object sourceObject | |
* @param string omitKeys, ... | |
* | |
* @return object | |
*/ |
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 function getTopDomain(url: string = "") { | |
url = url || window.location.hostname; | |
url = url.replace(/(https?:\/\/)?(www.)?/i, ""); | |
let urlArr = url.split("."); | |
url = urlArr.slice(urlArr.length - 2).join("."); | |
if (url.indexOf("/") !== -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
#!/bin/sh | |
files=$(git diff --cached --name-only --diff-filter=ACM | grep -v "genServices/" | grep -v "genAdminServices/") | |
tsFiles=$(echo "$files" | grep -E "\.tsx?$") | |
jsFiles=$(echo "$files" | grep -E "\.jsx?$") | |
if [ "$tsFiles" = "" -a "$jsFiles" = "" ]; then | |
exit 0 | |
fi |
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
{ | |
"typescript.tsdk": "./node_modules/typescript/lib", | |
"path-intellisense.mappings": { | |
"genServices": "${workspaceRoot}/genServices", | |
"~genServices": "${workspaceRoot}/genServices" | |
}, | |
"eslint.enable": true, | |
"prettier.useTabs": true, | |
"files.exclude": { | |
"node_modules": 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
class ExtensibleError extends Error { | |
constructor (message: string) { | |
super() | |
// Set this.message | |
Object.defineProperty(this, 'message', { | |
configurable: true, | |
enumerable: false, | |
value: message !== undefined ? String(message) : '' | |
}) |