Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt McFarland MattMcFarland

  • Software Engineer
  • Dayton, OH
View GitHub Profile
View 3-col-design.md

3 Column Design

Just a fast guide to applying a 3 column layout using HTML and CSS3.

the <span> method:

This is my personal favorite..

@MattMcFarland
MattMcFarland / git-unix-prompt.md
Last active Aug 29, 2015
Showing git status and branch while in unix command line interface
View git-unix-prompt.md

CentOS - ~./bashrc

Mac OS X - ~./profile

# Custom Personalised bash prompt #
# get current branch in git repo
function parse_git_branch() {
	BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
	if [ ! "${BRANCH}" == "" ]
	then
@MattMcFarland
MattMcFarland / npm-repair.sh
Created Aug 19, 2014
Repair common npm/bower/grunt issues with a single project
View npm-repair.sh
#/bin/bash
rm -rf node_modules && rm -rf bower_components
npm cache clean
npm install .
bower install
View webdev-debian.md

A web application dev kit for the modern age.

Some things I like to install grom the get-go:

Developer Tools:

I gotta have me some git and compilers to get started, this does the trick:

sudo apt-get install gcc gpp make g++ git -y
@MattMcFarland
MattMcFarland / bb-comparator.js
Last active Aug 29, 2015
Backbone Comparator Snippet
View bb-comparator.js
// This hidden gem was found at http://stackoverflow.com/questions/9865804/proper-way-to-sort-a-backbone-js-collection-on-the-fly (buried in the answers)
// Following example above do in the view:
// Assign new comparator
this.collection.comparator = function( model ) {
return model.get( 'lastname' );
}
// Resort collection
this.collection.sort();
@MattMcFarland
MattMcFarland / couchdbnow.sh
Last active Aug 29, 2015
Start up a couch db database for npm registry
View couchdbnow.sh
#/bin!bash
HOST="http://127.0.0.1:5984"
curl -X PUT $HOST/registry
curl -X PUT $HOST/_config/admins/$1 -d '"$2"'
npm start --npm-registry-couchapp:couch=http://$1:$2@localhost:5984/registry
@MattMcFarland
MattMcFarland / gimmeNodeNow.md
Last active Aug 29, 2015
No fuss, just get latest nodejs installed on ubuntu 14.04 damnit
View gimmeNodeNow.md

No fuss, no Muss.

Everytime I set up a new ubuntu 14.04 server and I want nodejs globally installed I have to go hunting.

So this just fixes everything.

# hope you ran with sudo

sudo apt-get update
@MattMcFarland
MattMcFarland / .profile
Last active Aug 29, 2015
A sexy bash configuration file for Web Application Developers (MAC OS X 10.10.4 (14E46))
View .profile
########## Web Application Development for BASH made easy
# This shell script contains a collection of excellent scripts I've found over the years that enhance development.
# It is organized much like a traditional etc/*conf file, and I hope others find it useful.
#
# YOU MUST HAVE X-CODE installed
#
# Features include:
# - Homebrew
# - Sexy git bash status prompt
# - NodeJS Version Manager (nvm)
@MattMcFarland
MattMcFarland / .gitignore
Created Sep 15, 2015
My .gitignore file (mac os, windows, nodejs, cloud9-ide, jetbrains ide)
View .gitignore
# Created by .ignore support plugin (hsz.mobi)
### Linux template
*~
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
### JetBrains template
@MattMcFarland
MattMcFarland / InRadius.as
Created Mar 3, 2011
Snippet: Function checking if an object is within radius of another.
View InRadius.as
/**
* Check to see if an object is within radius of another.
* @param x1 object1
* @param y1 object1
* @param x2 object2
* @param y2 object2
* @param radius Size of the radius, which is usually
* @return returns true if object2 is within radius of object 1
* @example if (InRadius(player.x,player.y,enemy.x,enemy.y,100)) trace ("enemy within a 100 pixel radius of player");
*/