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 getNumBitsSet(binary) { | |
var numbits = 0; | |
for (var v=binary; v; v>>=1) { | |
numbits += v&1; | |
} | |
return numbits; | |
} |
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
/* Custom text-selection colors (remove any text shadows: twitter.com/miketaylr/status/12228805301) */ | |
::-moz-selection { background: #fcd700; color: #fff; text-shadow: none; } | |
::selection { background: #fcd700; color: #fff; text-shadow: none; } |
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
/** | |
* Returns an array of set bits in a base 10 number. | |
* @param int base10 | |
* @return Array | |
*/ | |
var getSetBits = function ( base10 ) | |
{ | |
if (!base10) { | |
return; | |
} |
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
// the semi-colon before function invocation is a safety net against concatenated | |
// scripts and/or other plugins which may not be closed properly. | |
;(function ( $, window, document, undefined ) { | |
// undefined is used here as the undefined global variable in ECMAScript 3 is | |
// mutable (ie. it can be changed by someone else). undefined isn't really being | |
// passed in so we can ensure the value of it is truly undefined. In ES5, undefined | |
// can no longer be modified. | |
// window and document are passed through as local variable rather than global |
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
input[type=checkbox] { | |
-webkit-transform: scale(1.3, 1.3); | |
margin-left: 5px; | |
} |
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 locationhash = window.location.hash.replace('#', ''); |
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 stringToBoolean( value ) { | |
switch (typeof value) { | |
case "object": | |
case "string": return (/(true|1)/i).test(value); | |
case "number": return !!value; | |
case "boolean": return value; | |
case "undefined": return null; | |
default: return 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
.pure-g { | |
letter-spacing: -0.31em; | |
*letter-spacing: normal; | |
*word-spacing: -0.43em; | |
text-rendering: optimizespeed; | |
} | |
.opera-only :-o-prefocus, | |
.pure-g { | |
word-spacing: -0.43em; |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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
// in parent document | |
// no jQuery required | |
(function () { | |
var | |
ifr = document.getElementById('iframeid'), | |
vpadding = 50; | |
window.addEventListener( | |
"message", | |
function (ev) { | |
var d=ev.data.split(':'), k=d[0], v=d[1]; |
OlderNewer