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 convertTimestamp(timestamp) { | |
var d = new Date(timestamp * 1000), // Convert the passed timestamp to milliseconds | |
yyyy = d.getFullYear(), | |
mm = ('0' + (d.getMonth() + 1)).slice(-2), // Months are zero based. Add leading 0. | |
dd = ('0' + d.getDate()).slice(-2), // Add leading 0. | |
hh = d.getHours(), | |
h = hh, | |
min = ('0' + d.getMinutes()).slice(-2), // Add leading 0. | |
ampm = 'AM', | |
time; |
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 |
OlderNewer