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
iframe.attachEvent && iframe.attachEvent("onload", onload); | |
iframe.onload = onload; |
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($) { | |
var add = $.event.add; | |
$.event.add = function() { | |
var elem = arguments[0], | |
types = arguments[1]; | |
if ( !types || !elem ) return add.apply(this, arguments); | |
types = (types || "").match(/\S+/g) || []; | |
var events = $._data(elem).events; | |
if ( events && types.length ) { | |
$.each(types, function(i, type) { |
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
Animate = (function() { | |
var requestFrame = (function(){ | |
var r = 'RequestAnimationFrame' | |
return window.requestAnimationFrame || | |
window['webkit'+r] || | |
window['moz'+r] || | |
window['o'+r] || | |
window['ms'+r] || | |
function( callback ) { |
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(a, i, n, o) { | |
n = i.length && typeof require == 'function' ? (function(e, j, q) { | |
q = [] | |
for(j=0; j<i.length; j++){ | |
q.push(require(i[j])) | |
} | |
return e.apply(o, q) | |
}(n)) : n.call(o) |
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
$ cd /Library/WebServer | |
$ sudo -s | |
$ mv Documents Documents.old | |
$ sudo ln -s [projpath] . | |
$ mv [dirname] Documents | |
# Now just goto http://localhost and see all your local projects |
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 ie = (function() { | |
var v = 3 | |
, div = document.createElement( 'div' ) | |
, all = div.getElementsByTagName( 'i' ) | |
do | |
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->' | |
while | |
(all[0]) | |
return v > 4 ? v : document.documentMode | |
}()) |
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
git clean -d -fx "" |
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 keys = [37, 38, 39, 40] | |
var prevent = (e) => { | |
if ( e.type != 'keydown' || keys.indexOf(e.keyCode) != -1 ) { | |
e.preventDefault() | |
return false | |
} | |
} | |
var disableScroll = (node) => { | |
node = node || window | |
node.onwheel = node.ontouchmove = document.onkeydown = prevent |
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
findKey = (haystack, needle) => { | |
let found = false | |
const iterate = (obj) => ( | |
Object.keys(obj).forEach((key) => { | |
if (found === false) { | |
if (key === needle) { | |
found = key | |
} else if (obj[key] && typeof obj[key] === 'object') { | |
iterate(obj[key]) | |
} |
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
<html> | |
<head> | |
<style> | |
#content{height: 8000px; width: 800px; margin: 0 auto; background: yellow;position: relative;} | |
</style> | |
</head> | |
<body> | |
<div id="content"> | |
Lorem<br> | |
Lorem<br> |