Skip to content

Instantly share code, notes, and snippets.

@thomasbabuj
thomasbabuj / how-to-copy-aws-rds-to-local.md
Created November 12, 2020 12:03 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@thomasbabuj
thomasbabuj / CircuitBreaker.js
Created September 25, 2020 09:01 — forked from markmichon/CircuitBreaker.js
Basic CircuitBreaker Node
class CircuitBreaker {
constructor(request) {
this.request = request
this.state = "CLOSED"
this.failureThreshold = 3
this.failureCount = 0
this.successThreshold = 2
this.successCount = 0
this.timeout = 6000
this.nextAttempt = Date.now()
@thomasbabuj
thomasbabuj / walksync.js
Created July 8, 2020 11:13 — forked from kethinov/walksync.js
List all files in a directory in Node.js recursively in a synchronous fashion
// List all files in a directory in Node.js recursively in a synchronous fashion
var walkSync = function(dir, filelist) {
var fs = fs || require('fs'),
files = fs.readdirSync(dir);
filelist = filelist || [];
files.forEach(function(file) {
if (fs.statSync(dir + file).isDirectory()) {
filelist = walkSync(dir + file + '/', filelist);
}
else {
@thomasbabuj
thomasbabuj / manual-git-flow.md
Created May 1, 2020 11:16 — forked from indiesquidge/manual-git-flow.md
Manual Git Flow for a Feature Branch from the CLI

Manual Git Flow for a Feature Branch from the CLI

Brief Context

Back in 2010, Vincent Driessen wrote a post called A successful Git branching model. Besides being extremely well drafted and clear in it's intention, the post goes into great detail about Git branching strategies and release management. The model that Vincent (sobriquet "nvie") came up with was popularized as git-flow.

@thomasbabuj
thomasbabuj / docker-nuke
Created April 14, 2020 03:49 — forked from jonathanconway/docker-nuke
Nuke all docker images and containers ☢️
#!/bin/bash
docker rm --force $(docker ps --all -q)
docker rmi --force $(docker images --all -q)
@thomasbabuj
thomasbabuj / README.md
Created February 6, 2019 12:01 — forked from greyscaled/README.md
Sequelize + Express + Migrations + Seed Starter
@thomasbabuj
thomasbabuj / iterm2-solarized.md
Created November 22, 2018 08:38 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@thomasbabuj
thomasbabuj / SyncPath.js
Created August 15, 2018 13:16 — forked from davideast/SyncPath.js
Firebase Social Network Client Fanout
export class SyncPath {
constructor(rootRef, path) {
this._rootRef = rootRef;
this.user = this._rootRef.getAuth();
this._userDataRef = this._rootRef.child(path).child(this.user.uid);
this.data = {};
this._userDataRef.on('value', (snap) => this.data = snap.val() || {});
}
keys() {
return Object.keys(this.data);
@thomasbabuj
thomasbabuj / rest_quick_reference.md
Created June 26, 2018 11:15 — forked from odan/rest_quick_reference.md
REST, RESTful API Quick Reference

REST, RESTful API Quick Reference

A good API is not just easy to use but also hard to misuse.

Ressources

  • Version your API
    • Path: /v1/users
    • Subdomain: api.v1.example.com/users
@thomasbabuj
thomasbabuj / promises.md
Created June 18, 2018 05:31 — forked from domenic/promises.md
You're Missing the Point of Promises

This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.

You're Missing the Point of Promises

Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:

getTweetsFor("domenic", function (err, results) {
 // the rest of your code goes here.