Skip to content

Instantly share code, notes, and snippets.

@patmood
patmood / regex.js
Last active August 29, 2015 14:03
Javascript Email validation regex
var string = si_eg-h+esg34576457s@slei.ghsegse.lsi.ehg.com
string.match(/^(\w|\+|\d|\-|\.)+\@(\w|\d|\-)+\.(\w|\.)+$/i)

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@patmood
patmood / tmux_reference
Last active August 29, 2015 14:00
tmux cheat sheet
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
patmood / README.md
Last active February 22, 2017 18:28
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:

 HOLD UP!
 You are trying to commit directly to *master* branch.
 (>_<)

 You can force the commit by adding --no-verify to the command.
@patmood
patmood / clean_branches.md
Last active August 29, 2015 13:57
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: http://stevenharman.net/git-clean-delete-already-merged-branches

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

@patmood
patmood / .vimrc
Created February 6, 2014 17:34
.vimrc Feb 6th 2014
syntax on
filetype off
set hlsearch
" Remove trailing whitespace on save
autocmd BufWritePre * :%s/\s\+$//e
" add mouse scrolling
set mouse=a
map <ScrollWheelUp> <C-Y>
@patmood
patmood / .vimrc
Last active January 2, 2016 16:39
.vimrc Jan 20th 2014
syntax on
filetype off
" make "tab" insert indents instead of tabs at the beginning of a line
set smarttab
" always uses spaces instead of tab characters
set expandtab
" size of a hard tabstop
set tabstop=2
@patmood
patmood / imgur_upload_ember.html
Last active December 28, 2015 21:19
Handle image uploads to imgur (within ember) using formdata
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<script src="http://code.jquery.com/jquery-2.0.2.js"></script>
<script src="http://builds.emberjs.com/handlebars-1.0.0.js"></script>
<script src="http://builds.emberjs.com/ember-latest.js"></script>
</head>
<body>
@patmood
patmood / ember_imgur.html
Last active December 28, 2015 18:38
Ember app with Imgur API
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<script src="http://code.jquery.com/jquery-2.0.2.js"></script>
<script src="http://builds.emberjs.com/handlebars-1.0.0.js"></script>
<script src="http://builds.emberjs.com/ember-latest.js"></script>
</head>
<body>
@patmood
patmood / ember_hackernews.html
Last active December 28, 2015 18:29
Ember app that reads hacker news feed with via JSONP api
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<script src="http://code.jquery.com/jquery-2.0.2.js"></script>
<script src="http://builds.emberjs.com/handlebars-1.0.0.js"></script>
<script src="http://builds.emberjs.com/ember-latest.js"></script>
</head>
<body>