Skip to content

Instantly share code, notes, and snippets.

View ohall's full-sized avatar
🚀

Oakley Hall ohall

🚀
View GitHub Profile
@ohall
ohall / a-pragmatic-quick-reference.sh
Last active December 29, 2015 22:19
I keep this in my bash_profile to remind myself to be better.
########## A Pragmatic Quick Reference ######################################
#
# by Jeff Atwood
# http://www.codinghorror.com/blog/2004/10/a-pragmatic-quick-reference.html
#..............................................................................
rules="\n
1. Care About Your Craft\n
2. Think! About Your Work\n
3. Provide Options, Don't Make Lame Excuses\n
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|Ja|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)/)(?:[^\s()<>{}\[\]]+|\([^\s()]*?\([^\s()]+\)[^\s()]*?\)|\([^\s]+?\))+(?:\([^\s()
@ohall
ohall / _mapArray
Created November 19, 2014 20:42
map and array with underscore
var collection = [1, 2, 3];
_.map(collection, function(val, index, array){ return num * 3; });
// returns array -> [3, 6, 9]
@ohall
ohall / simple.html
Created November 19, 2014 22:29
A very simple BackboneJS view with model http://jsfiddle.net/oakley349/ate0Lpos/4/
<style>
#rootEl {
color:#FFFFFF;
text-align:center;
height:50px;
width:150px;
background-color:red;
}
</style>
<div id="rootEl"><h3>Click Me</h3></div>
@ohall
ohall / models.js
Created November 19, 2014 22:35
a Backbone model with callbacks
models.OrgsModel = Backbone.Model.extend({
url: function() {
return root + 'organizations.json';
},
behavior: function (org) {
loc.org = org;
utils.nav(org);
},
defaultItem: function () {
return loc.org;
@ohall
ohall / deleteBranch.sh
Last active August 29, 2015 14:10
Delete a branch from# git
#!/bin/sh
if [ -z $1 ];
then
echo 'USAGE: specify a branch to delete'
else
#delete a local branch
git branch -d $1
#delete a remote branch
@ohall
ohall / killer.sh
Created December 4, 2014 14:52
Find and kill process by port
lsof -i :9000 #or whatever port
kill -9 pID
@ohall
ohall / npmmine.sh
Last active August 29, 2015 14:11
Reclaim ownership of NPM modules
sudo chown -R `whoami` ~/.npm
sudo chown -R `whoami` /usr/local/lib/node_modules
@ohall
ohall / wsserver.sh
Created January 27, 2015 14:54
Check who's clobbering WebStorm server
lsof -i TCP:63342
@ohall
ohall / smoothScrolling.md
Created January 27, 2015 21:50
Performs a smooth page scroll to an anchor on the same page.

##Smooth Scrolling Performs a smooth page scroll to an anchor on the same page.

$(function() {
  $('a[href*=#]:not([href=#])').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
      var target = $(this.hash);
      target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
 if (target.length) {