- Homebrew should be installed (Command line tools for Xcode are included).
- Install
nvmvia Homebrew
| import customModuleLoader = require('module'); | |
| export class CustomModuleLoader { | |
| public cOptions: any = require('../tsconfig.json').compilerOptions; | |
| public replacePaths: any = {}; | |
| constructor() { | |
| Object.keys(this.cOptions.paths).forEach(alias => { | |
| this.replacePaths[alias.replace(/\*.?/, '(.*)')] = this.cOptions.paths[alias][0].replace(/\*.?/, '$1'); |
| 1. Install oh my zsh | |
| http://ohmyz.sh/ | |
| $ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | |
| 1. Install powerline fonts | |
| https://github.com/powerline/fonts | |
| 1. download agnoster theme | |
| https://github.com/mbadolato/iTerm2-Color-Schemes/zipball/master |
| const AWS = require('aws-sdk') | |
| AWS.config.update({ region: 'us-east-1' }) | |
| const { DynamoDB } = AWS | |
| const dynamoDB = new DynamoDB.DocumentClient() | |
| module.exports.query = function (attributeName, attributeValue, tableName) { | |
| const params = { | |
| ExpressionAttributeNames: { | |
| [`#${attributeName}`]: attributeName |
nvm via Homebrew| // === Arrays | |
| var [a, b] = [1, 2]; | |
| console.log(a, b); | |
| //=> 1 2 | |
| // Use from functions, only select from pattern | |
| var foo = () => [1, 2, 3]; |
| # first: | |
| lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
| sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
| # To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
| # go to /usr/local/lib and delete any node and node_modules | |
| cd /usr/local/lib | |
| sudo rm -rf node* |
| function logClass(target: any) { | |
| // save a reference to the original constructor | |
| var original = target; | |
| // a utility function to generate instances of a class | |
| function construct(constructor, args) { | |
| var c : any = function () { | |
| return constructor.apply(this, args); | |
| } |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>My Iframe</title> | |
| </head> | |
| <body> | |
| <button>Botão</button> | |
| <script type="text/javascript"> |
| var Middleware = function() {}; | |
| Middleware.prototype.use = function(fn) { | |
| var self = this; | |
| this.go = (function(stack) { | |
| return function(next) { | |
| stack.call(self, function() { | |
| fn.call(self, next.bind(self)); | |
| }); |