Skip to content

Instantly share code, notes, and snippets.

View davidsonsns's full-sized avatar
🎯
Focusing

Davidson Nascimento davidsonsns

🎯
Focusing
  • San Diego, CA
View GitHub Profile
const cloakedStringRegex =
/^v1\.aesgcm256\.(?<fingerprint>[0-9a-fA-F]{8})\.(?<iv>[a-zA-Z0-9-_]{16})\.(?<ciphertext>[a-zA-Z0-9-_]{22,})={0,2}$/;
const cloakKeyRegex = /^k1\.aesgcm256\.(?<key>[a-zA-Z0-9-_]{43}=?)$/;
const INVALID_BYTE = 256;
class Coder {
constructor(_paddingCharacter = '=') {
this._paddingCharacter = _paddingCharacter;
@davidsonsns
davidsonsns / TransferAndEvents.md
Created June 14, 2023 20:10 — forked from spencerhunter/TransferAndEvents.md
Outlines the sequence of events that are triggered for a subset of Dwolla payment flows that are bank-to-bank via ACH

Overview

Use this doc as a reference to map out the sequence of events your app will receive based on Customer type(s) involved in the transfer as well as where the funds are coming from and going to (bank or balance). The following transfer scenarios are covered in this doc:

Transfer scenario 1 - Source: Verified Customer bank Destination: Verified Customer bank.
Transfer scenario 2 - Source: Verified Customer bank Destination: Unverified Customer bank.
Transfer scenario 3 - Source: Unverified Customer bank Destination: Verified Customer bank.

Both success and failure cases will be shown as well as what occurs in the event of a bank transfer failure.

**General recommend

@davidsonsns
davidsonsns / ultimate-ut-cheat-sheet.md
Created December 26, 2019 13:11 — forked from yoavniran/ultimate-ut-cheat-sheet.md
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai and Sinon

The Ultimate Unit Testing Cheat-sheet

For Mocha, Chai and Sinon

using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies


@davidsonsns
davidsonsns / iterm2.md
Created November 28, 2019 11:52 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@davidsonsns
davidsonsns / iterm2-solarized.md
Created October 26, 2019 15:06 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@davidsonsns
davidsonsns / better-nodejs-require-paths.md
Created August 1, 2018 13:50 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@davidsonsns
davidsonsns / requireAll.js
Last active June 1, 2018 15:50
Require every file in a directory
/**
* Baseaded in this issue
* @link https://github.com/webpack/webpack/issues/625
*/
import set from 'lodash/set';
import trimStart from 'lodash/trimStart';
const context = require.context('src/assets');
const obj = {};
context.keys().forEach(function(key) {
@davidsonsns
davidsonsns / localtunnel-forever.js
Created March 11, 2018 11:49
run localtunnel forever
const localtunnel = require('localtunnel')
const tunels = [{
subdomain: 'youDomain',
local_host: 'localhost',
port: 4000,
}, {
subdomain: 'youDomain',
local_host: 'localhost',
port: 3000,
@davidsonsns
davidsonsns / mongo_backup.sh
Created December 5, 2017 17:39 — forked from sheharyarn/mongo_backup.sh
Mongodump Shell Script for Cronjob
#!/bin/bash
MONGO_DATABASE="your_db_name"
APP_NAME="your_app_name"
MONGO_HOST="127.0.0.1"
MONGO_PORT="27017"
TIMESTAMP=`date +%F-%H%M`
MONGODUMP_PATH="/usr/bin/mongodump"
BACKUPS_DIR="/home/username/backups/$APP_NAME"
@davidsonsns
davidsonsns / gitflow-breakdown.md
Created December 5, 2017 11:36 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository