Skip to content

Instantly share code, notes, and snippets.

Avatar

Kyle Florence kflorence

  • Solar Mosaic, Inc.
  • Austin, Texas
View GitHub Profile
View isArguments.js
var isArguments = (function( undefined ) {
var toString = Object.prototype.toString,
returnTrue = function() {
return arguments !== undefined;
};
return function( obj ) {
if ( obj != null ) {
if ( toString.call( obj ) == "[object Arguments]" ) {
return true;
@kflorence
kflorence / amazonmp3ubuntu64.sh
Created Aug 11, 2011
Amazon MP3 Ubuntu 10.04 64-bit Install
View amazonmp3ubuntu64.sh
wget http://frozenfox.freehostia.com/cappy/getlibs-all.deb
sudo dpkg -i getlibs-all.deb
wget http://amazonm-002.vo.llnwd.net/u/d1/clients/en_US/1.0.9/amazonmp3_1.0.9~ibex_i386.deb
sudo getlibs -w http://old-releases.ubuntu.com/ubuntu/pool/main/b/boost/libboost-filesystem1.34.1_1.34.1-11ubuntu1_i386.deb http://old-releases.ubuntu.com/ubuntu/pool/main/b/boost/libboost-regex1.34.1_1.34.1-11ubuntu1_i386.deb http://old-releases.ubuntu.com/ubuntu/pool/main/b/boost/libboost-date-time1.34.1_1.34.1-11ubuntu1_i386.deb http://old-releases.ubuntu.com/ubuntu/pool/main/b/boost/libboost-signals1.34.1_1.34.1-11ubuntu1_i386.deb http://old-releases.ubuntu.com/ubuntu/pool/main/b/boost/libboost-iostreams1.34.1_1.34.1-11ubuntu1_i386.deb http://old-releases.ubuntu.com/ubuntu/pool/main/b/boost/libboost-thread1.34.1_1.34.1-11ubuntu1_i386.deb http://old-releases.ubuntu.com/ubuntu/pool/main/i/icu/libicu38_3.8.1-2ubuntu0.2_i386.deb
sudo dpkg -i --force-all amazonmp3.deb
sudo getlibs /usr/bin/amazonmp3
@kflorence
kflorence / parseUri.js
Created Aug 24, 2011
Modified version of Steven Levithan's parseUri 1.2.2
View parseUri.js
// Modified version of Steven Levithan's parseUri 1.2.2
// See: http://blog.stevenlevithan.com/archives/parseuri
function parseUri( uri ) {
var uriRegex = new RegExp(
// Protocol
"^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?://)?" +
// Authority
"(" +
// Credentials
"(?:(" +
@kflorence
kflorence / border-opacity.scss
Created Jan 18, 2012
SASS Border Opacity Mixin
View border-opacity.scss
// Opacity should be on a 100 point scale (0-100 instead of 0.0-1.0)
// This should be used to supplement a normal border definition as it
// only deals with the 'border-color' property.
@mixin border-opacity($color, $opacity) {
$opacity: $opacity / 100;
// Unsupporting browsers get this
border-color: $color;
// Browsers that support RGBA will get this instead
@kflorence
kflorence / arrow.scss
Created Apr 2, 2012
@mixin arrow($color, $width)
View arrow.scss
/*
HTML: <img class="arrow" src="<?= $wg->BlankImgUrl ?>" />
SASS: .arrow { @include arrow(); }
*/
@mixin arrow($width: 4px, $color: black, $direction: 'down') {
border-color: transparent;
// Fixes the 'jagged line' problem for modern browsers
// See: http://css-tricks.com/snippets/css/css-triangle/#comment-108252
border-color: rgba($color, 0);
View clearfix.css
.clearfix {
height: 1%; /* trigger hasLayout for IE < 8 */
}
.clearfix:before, .clearfix:after {
content: " ";
display: block;
height: 0;
visibility: hidden;
}
@kflorence
kflorence / exec.js
Created May 15, 2012
Call a function only if it is defined
View exec.js
var exec = (function(global) {
return function(name, args, context) {
var func = (context = context || global)[name];
return (typeof func != 'undefined') && func.apply(context, args);
};
})(this);
// Use like:
var timesTwo = function(x) {
return x * 2;
@kflorence
kflorence / getType.js
Created Aug 29, 2012
Enhanced version of jQuery.type that will return class names for user generated Objects
View getType.js
var getType = (function() {
var rFunctionName = /function ([^(]+)/;
return function( object ) {
var matches,
type = $.type( object );
if ( type == "object" ) {
matches = rFunctionName.exec( object.constructor.toString() );
@kflorence
kflorence / namespacer.js
Last active Dec 10, 2015
A simple function for namespacing things like events and class names
View namespacer.js
// namespacer( "kf", [ "one", "two" ] );
// => { one: "one.kf", two: "two.kf" }
function namespacer( namespace, items, separator, before ) {
var i, item,
l = items.length,
namespaced = {};
if ( l && namespace ) {
if ( !separator ) {
separator = ".";
@kflorence
kflorence / join.js
Created Jan 1, 2013
Simple function for joining non-Array object properties
View join.js
// join( { one: "one", two: "two" } );
// => "one,two"
function join( obj, separator ) {
var k,
items = [];
if ( typeof obj.join === "function" ) {
items = obj;
} else {