Skip to content

Instantly share code, notes, and snippets.

Avatar

Kyle Florence kflorence

  • Solar Mosaic, Inc.
  • Austin, Texas
View GitHub Profile
@kflorence
kflorence / git-tidy-alias
Created Feb 20, 2014
Git alias for removing stale branches that have already been merged into master
View git-tidy-alias
[alias]
tidy = !git branch --merged master | grep -v 'master$' | xargs git branch -d && git remote | xargs -n 1 git remote prune
View ubuntu_setup.md

Chrome

LastPass

Spotify

Use above instructions to install the Spotify Linux preview.

Git

sudo apt-get install git
@kflorence
kflorence / 1password
Created Feb 9, 2015
Serve 1Password Anywhere from Dropbox folder
View 1password
# Serve 1Password anywhere from the Dropbox folder
server {
listen 80;
server_name 1password;
root /home/kflorence/Dropbox/1Password.agilekeychain;
location / {
index 1Password.html;
}
}
@kflorence
kflorence / .bash_profile
Created Apr 8, 2015
.bash_profile Mac OS X
View .bash_profile
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
# Nicer looking prompt with git branch in it
# https://github.com/mbadolato/iTerm2-Color-Schemes
export PS1="\[\033[36m\]\u\[\033[m\]:\[\033[33;1m\]\w\[\033[m\]\[\033[35;1m\]\$(parse_git_branch)\[\033[m\]\$ "
# ls colors
export CLICOLOR=1
@kflorence
kflorence / jquery.plugin.js
Created Nov 17, 2010
jQuery plugin pattern
View jquery.plugin.js
(function($) {
// $.widget-lite
$.plugin = function(name, base, prototype) {
if (!prototype) {
prototype = base;
base = function(options, element) {
if (arguments.length) {
$.data(element, name, this);
this.element = $(element);
this._init(options);
@kflorence
kflorence / ieChangeFix.js
Created Jan 8, 2011
Fix for IE not firing the change event for certain inputs (namely, checkboxes and multiple select lists).
View ieChangeFix.js
/**
* Fixes binding the "change" event to checkboxes and select[type=multiple]
* for Internet Explorer.
*
* @param {jQuery|Element|Element[]} elements
* The DOM Element we wish to bind the event to.
*
* @param {String} eventType
* The name of the event we want to bind to.
*
View IE_Version_Testing.js
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@kflorence
kflorence / jquery-attached-detatched.js
Created Apr 28, 2011
Convenience methods to determine whether or not an element is attached or detached from the DOM
View jquery-attached-detatched.js
(function( jQuery ) {
jQuery.extend({
attached: function( elem ) {
if ( elem instanceof jQuery ) {
elem = elem[ 0 ];
}
return jQuery.contains( elem.ownerDocument.documentElement, elem );
},
detached: function( elem ) {
View isArrayLike.js
(function( jQuery ) {
// Determines if we can treat an object like an array.
var isArrayLike = function( obj ) {
var length;
// Supports arrays, jQuery objects, nodeLists and HTMLCollections
// Should also support function arguments, but there is no cross-browser way...
return obj && ( obj instanceof jQuery || ( typeof obj === "object" &&
!jQuery.isWindow( obj ) && ( typeof ( length = obj.length ) === "number" &&
( obj.item && ( obj.namedItem || jQuery.isFunction( obj.item ) ) ) ) || jQuery.isArray( obj ) ) );