Skip to content

Instantly share code, notes, and snippets.

Work until you no longer have to represent yourself.!

Đinh Văn Hoàng hoangsetup

Work until you no longer have to represent yourself.!
Block or report user

Report or block hoangsetup

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View app.js
const express = require('express');
const bodyParser = require('body-parser');
const jwt = require('jsonwebtoken');
const router = express.Router();
const config = require('./config');
const utils = require('./utils');
const tokenList = {};
const app = express();
router.get('/', (req, res) => {
hoangsetup / CustomModuleLoader.ts
Created Apr 26, 2019 — forked from deejayy/CustomModuleLoader.ts
Solves the problem with typescript->javascript compilation and module path aliases (compilerOptions.paths).
View CustomModuleLoader.ts
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');
hoangsetup / gist:d4f007e088d6e411aee81e004bf037c4
Created Apr 18, 2019 — forked from 480/gist:3b41f449686a089f34edb45d00672f28
MacOS X + oh my zsh + powerline fonts + visual studio code terminal settings
View gist:d4f007e088d6e411aee81e004bf037c4
1. Install oh my zsh
$ sh -c "$(curl -fsSL"
1. Install powerline fonts
1. download agnoster theme
hoangsetup / index.ts
Created Apr 15, 2019
Integrate SQS and Lambda
View index.ts
// Consumer
import {
SQSHandler, SQSRecord,
} from "aws-lambda";
import * as Lambda from "aws-sdk/clients/lambda";
import { InvocationRequest, InvocationResponse } from "aws-sdk/clients/lambda";
async function invokeWorkerLambda(record: SQSRecord): Promise<InvocationResponse> {
const lambda = new Lambda({region: process.env.AWS_REGION});
View dynamodb-helpers.js
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

Install NVM, NodeJS, Yarn via Homebrew


  • Homebrew should be installed (Command line tools for Xcode are included).

Getting start

Install NVM and NodeJS

  1. Install nvm via Homebrew
hoangsetup / destructuring.js
Created Feb 18, 2019 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic:
View destructuring.js
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
View gist:152c18b89fe10e489cc9b5921215ab6d
# first:
lsbom -f -l -s -pf /var/db/receipts/ | 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*
hoangsetup / class_decorator.ts
Created Nov 27, 2018 — forked from remojansen/class_decorator.ts
TypeScript Decorators Examples
View class_decorator.ts
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);
hoangsetup /
Created Oct 24, 2018 — forked from bgromov/
Git: reset author for ALL commits
# Credits:
git filter-branch -f --env-filter "
You can’t perform that action at this time.