This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get ordinal value | |
* | |
* @param n {number} if a string is provided, % will attempt to convert to number | |
* @returns {string} th, st, nd, rd | |
*/ | |
function getOrdinal(n) { | |
var ordArr = ['th', 'st', 'nd', 'rd']; | |
var modulus = n % 100; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var global = { | |
konami: function() { | |
var konamikeys = [38,38,40,40,37,39,37,39,66,65], | |
started = false, | |
count = 0; | |
$(document).keydown(function(e){ | |
var reset = function() { | |
started = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function timeAgo($dateStr) { | |
$timestamp = strtotime($dateStr); | |
$day = 60 * 60 * 24; | |
$today = time(); // current unix time | |
$since = $today - $timestamp; | |
// If it has been less than 1 day since the tweet was posted, figure out how long ago in seconds/minutes/hours | |
if (($since / $day) < 1) { | |
$timeUnits = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function timeAgo($dateStr) { | |
$timestamp = strtotime($dateStr); | |
$timeUnits = array( | |
array(60 * 60 * 24 * 365 , 'year'), | |
array(60 * 60 * 24 * 30 , 'month'), | |
array(60 * 60 * 24 * 7, 'week'), | |
array(60 * 60 * 24 , 'day'), | |
array(60 * 60 , 'hour'), | |
array(60 , 'minute') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.fn.methodName = function(){ | |
return this.each(function(index, element){ | |
$(this) | |
.html('A method was called on me!') | |
.css('background', 'green'); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var typeCast = function(string) { | |
if (!!string) { | |
document.write('<p>' + string + ': true</p>'); | |
} else { | |
document.write('<p>' + string + ': false</p>'); | |
} | |
}; | |
typeCast("Hello there"); | |
typeCast(""); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function resizedFn(){ | |
// Haven't resized in 200ms! | |
// Run this code | |
} | |
var debounceResize; | |
$(window).resize(function(){ | |
clearTimeout(debounceResize); | |
debounceResize = setTimeout(resizedFn, 200); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* using with Modernizr: */ | |
.touch p a { | |
margin: 0 -.5em; | |
padding: 0 .5em; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* CSS Reset + Normalize | |
* Author: Kim Maida | |
* Author URI: <http://kim-maida.com> | |
* Source: <https://github.com/kmaida | |
* License: GNU Public License | |
*/ | |
/*-------------------- | |
CSS RESET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.animated-ng-if { | |
&.ng-enter { | |
transition: max-height 350ms ease-in; /* transition the height FROM 0 to x when entering (autoprefix or use mixin) */ | |
max-height: 0; | |
} | |
&.ng-enter.ng-enter-active, | |
&.ng-leave { | |
max-height: 600px; /* max-height when active (adjust value to fit needs) */ | |
} | |
&.ng-leave.ng-leave-active { |