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
/* | |
* Normalized hide address bar for iOS & Android | |
* (c) Scott Jehl, scottjehl.com | |
* MIT License | |
*/ | |
(function( win ){ | |
var doc = win.document; | |
// If there's a hash, or addEventListener is undefined, stop here | |
if( !location.hash && win.addEventListener ){ |
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 logtime = (function() { | |
var ids = {}; | |
return function(id) { | |
if (!ids[id]) { | |
ids[id] = +new Date(); | |
return; | |
} | |
var time = +new Date() - ids[id]; |
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
/* | |
src: http://jsconsole.com/?v%20%3D%204%3B%20'0'.substr(v%20%3C%2010%20%3F%200%20%3A%201)%20%2B%20v%3B | |
via @rem | |
*/ | |
v = 4; '0'.substr(v < 10 ? 0 : 1) + v; |
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 getSelection() { | |
return (!!document.getSelection) ? document.getSelection() : | |
(!!window.getSelection) ? window.getSelection() : | |
document.selection.createRange().text; | |
} |
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
Object.deepExtend = function(destination, source) { | |
for (var property in source) { | |
if (source[property] && source[property].constructor && | |
source[property].constructor === Object) { | |
destination[property] = destination[property] || {}; | |
arguments.callee(destination[property], source[property]); | |
} else { | |
destination[property] = source[property]; | |
} | |
} |
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
/* | |
http://css-tricks.com/snippets/css/clear-fix/ | |
*/ | |
.group:before, | |
.group:after { | |
content:""; | |
display:table; | |
} | |
.group:after { | |
clear:both; |
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
//this needs to go somewhere | |
var modules = {}; | |
modules.ajax = function(){ | |
var args = Array.prototype.slice.call(arguments), createXMLHTTPObject = function(){ | |
var xmlhttp, XMLHttpFactories = [ | |
function() { return new XMLHttpRequest(); } | |
,function() { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } | |
,function() { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } | |
,function() { return new ActiveXObject('Msxml2.XMLHTTP'); } | |
,function() { return new ActiveXObject('Msxml3.XMLHTTP'); } |
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
//modify this as needed just a reminder of how to do it | |
function SelectAll(id) | |
{ | |
document.getElementById(id).focus(); | |
document.getElementById(id).select(); | |
} |
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 addEvent(target, type, handler) { | |
if (target.addEventListener){ | |
target.addEventListener(type, handler, false); | |
}else{ | |
target.attachEvent("on" + type, | |
function(event) { | |
// Invoke the handler as a method of target, | |
// passing on the event object | |
return handler.call(target, event); | |
}); |
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 page = require('webpage').create(), | |
t, address; | |
if (phantom.args.length === 0) { | |
console.log('Usage: findlink.js <some URL>'); | |
phantom.exit(); | |
} else { | |
t = Date.now(); | |
address = phantom.args[0]; | |
page.open(address, function (status) { |
OlderNewer