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.checkbox = function () { | |
return this.find('input[type="checkbox"]'); | |
}; |
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 query( key ) { | |
if ( location.href.indexOf("?") !== -1 ) { | |
var q = location.search, | |
p = [], | |
i, val; | |
q = q.slice(1); | |
if ( q.indexOf("&") !== -1 ) { | |
q = q.split("&"); | |
for ( i=0; i < q.length; i++ ) { | |
p.push( q[i].split("=") ); |
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
<a href="javascript:(function(){localStorage.clear();})();">Clear localStorage</a> |
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
if ( localStorage.length > 0 ) { | |
for ( let i=0; i < localStorage.length; i++ ) { | |
console.log( `${localStorage.key(i)}:${localStorage.getItem( localStorage.key(i) )}` ); | |
} | |
} |
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
<a href="javascript:(function(){if(localStorage.length){for(var i=0;i<localStorage.length;i++){console.log(localStorage.key(i)+':'+localStorage.getItem(localStorage.key(i)));}}})();">Check localStorage</a> |
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
<!-- include jQuery --> | |
<script> | |
$('form').find('input:text').val( function(i, val) { | |
return $(this).attr('name'); | |
}); | |
$('form').find('select').each( function(a) { | |
$(this).find('option').each( function(b) { | |
if ( $(this).val() !== '' ) { | |
$(this).parent().val( $(this).val() ); |
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
module.exports = (function(){ | |
const MS = | |
{ seconds: 1000 | |
, minutes: 60 * 1000 | |
, hours: 60 * 60 * 1000 | |
, days: 24 * 60 * 60 * 1000 | |
, weeks: 7 * 24 * 60 * 60 * 1000 | |
, months: 30 * 7 * 24 * 60 * 60 * 1000 | |
, years: 365 * 24 * 60 * 60 * 1000 } |
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
/* | |
Ex: | |
ftn.extend({ | |
foo: function() { | |
console.log( "foo" ); | |
} | |
}); | |
ftn.foo(); |
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
/* | |
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/ | |
* Better handling of scripts without supplied ids. | |
* | |
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function. | |
*/ | |
(function(doc, script) { | |
var js, | |
fjs = doc.getElementsByTagName(script)[0], |
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
/* 1. write it out for older browsers */ | |
/* 2. use the vendor prefix for webkit */ | |
/* 3. use the vendor prefix for moz */ | |
/* 4. include the un-prefixed version last */ | |
#foo { | |
width: 200px; | |
width: -webkit-calc(50% - 100px); | |
width: -moz-calc(50% - 100px); | |
width: calc(50% - 100px); |
OlderNewer