Skip to content

Instantly share code, notes, and snippets.

Patrick Moody patmood

Block or report user

Report or block patmood

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
patmood / mailchimp-firebase.js
Created Oct 1, 2017 — forked from eibrahim/mailchimp-firebase.js
A node worker for firebase to add a user to mailchimp
View mailchimp-firebase.js
var mcapi = require('./node_modules/mailchimp-api/mailchimp');
var usersRef = db.ref('users');
var mc = new mcapi.Mailchimp('xxxxxxxxxx-api-key-us4');
var user = snapshot.val();
var key = snapshot.key;
if(user &&{
var listId = 'xxxx-list-id-xxxx';
var name = user.displayName || '';
patmood / basscss.css
Created Jul 14, 2017
Basscss in a single file
View basscss.css
/* Basscss Type Scale */
.h1 { font-size: var(--h1) }
.h2 { font-size: var(--h2) }
.h3 { font-size: var(--h3) }
.h4 { font-size: var(--h4) }
.h5 { font-size: var(--h5) }
.h6 { font-size: var(--h6) }
:root {
patmood / bubbleSort.js
Last active Nov 6, 2016
Javascript Bubble Sort
View bubbleSort.js
// Bubble sort
// Time: O(n^2)
// Space: O(1)
const test = require('assert').deepEqual
const bubbleSort = (arr) => {
// Create a variable to store values temporarily - Only needs to be created once for O(1) space complexity
let temp = null
patmood / quicksort.js
Last active Feb 27, 2019
Javascript Quicksort
View quicksort.js
// Quicksort
// Time: O(n log(n))
// Space: O(log(n))
const test = require('assert').deepEqual
const quickSort = (arr) => {
if (arr.length <= 1) return arr
const pivotIndex = arr.length - 1
View ANSI-color-codes.txt
TP_ANSI_RESET "\x1b[0m"
TP_ANSI_BOLD_ON "\x1b[1m"
TP_ANSI_BOLD_OFF "\x1b[22m"
TP_ANSI_FG_BLACK "\x1b[30m"
TP_ANSI_FG_RED "\x1b[31m"
TP_ANSI_FG_GREEN "\x1b[32m"
TP_ANSI_FG_YELLOW "\x1b[33m"
TP_ANSI_FG_BLUE "\x1b[34m"
patmood / regex.js
Last active Aug 29, 2015
Javascript Email validation regex
View regex.js
var string =
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname
patmood / tmux_reference
Last active Aug 29, 2015
tmux cheat sheet
View tmux_reference
Split vertically: <Ctrl-b>%
Split horizontally: <Ctrl-b>"
Move around panes: <Ctrl-b>[Up, Down, Right, Left]
Previous pane: <Ctrl-b>;
Rotate panes: <Ctrl-b><Ctrl-o>
Resize: <Ctrl-b>:resize-pane -U[D,L,R] 10
Close pane: <Ctrl-b>x
patmood /
Last active Feb 22, 2017
Git pre-commit to prevent bad commits (forbidden branches and code)

What it does

If you try to commit directly to a "forbidden" branch like master or staging, you'll get a warning like this:

 You are trying to commit directly to *master* branch.

 You can force the commit by adding --no-verify to the command.
patmood /
Last active Aug 29, 2015
Delete all merged branches from a repo

Clean up old git branches

This will delete branches that have already been merged. Good for cleaning up local repos. Wont delete your current branch.

git branch --merged | grep -v "\*" | xargs -n 1 git branch -d

Saved here for my own reference but all credit to this guy:

WARNING: This will only spare your current branch. Remember that you might lose master/staging/etc if you're not currently on that branch.

You can’t perform that action at this time.