A Pen by Mike Behnke on CodePen.
This file contains hidden or 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#forIn, Object#forOwn | |
* | |
* Copyright (c) 2012 "Cowboy" Ben Alman | |
* Licensed under the MIT license. | |
* http://benalman.com/about/license/ | |
*/ | |
Object.defineProperties(Object.prototype, { | |
forIn: { |
A curated list by Eric Elliott and friends. Suggest links in the comments below.
This is a very exclusive collection of only must-have JavaScript links. I'm only listing my favorite links. Nothing else makes the cut. Feel free to suggest links if you think they're good enough to make this list. The really curious should feel free to browse the comments to find other links. I can't guarantee the quality of links in the comments.
Some of these links are affiliate links, meaning that if you make a purchase, I might earn a little money. This has absolutely no bearing on whether or not links make the list. None, whatsoever. However, it does allow me more resources to fight poverty with code. Every little bit counts.
This file contains hidden or 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
.eot - application/vnd.ms-fontobject | |
.woff - application/font-woff | |
.ttf - application/x-font-truetype | |
.svg - image/svg+xml | |
.otf - application/x-font-opentype | |
IIS (Web.Config) | |
<remove fileExtension=".eot" /> | |
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" /> | |
<remove fileExtension=".ttf" /> |
This file contains hidden or 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 executeOnDomNodeLoaded(node, func) { | |
// This function will check, every tenth of a second, to see if | |
// our element is a part of the DOM tree - as soon as we know | |
// that it is, we execute the provided function. | |
var findUltimateAncestor = function(node) { | |
// Walk up the DOM tree until we are at the top (parentNode | |
// will return null at that point). | |
// NOTE: this will return the same node that was passed in | |
// if it has no ancestors. | |
var ancestor = node; |
This file contains hidden or 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
<div id="fb-root"></div> | |
<script> | |
window.fbAsyncInit = function() { | |
FB.init({ | |
appId: 'FBAPPID', // App ID | |
status: true, // check login status | |
cookie: true, // enable cookies to allow the server to access the session | |
xfbml: true // parse XFBML | |
}); |
This file contains hidden or 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
<script> | |
(function(w, d, s) { | |
function go() { | |
var js, fjs = d.getElementsByTagName(s)[0], load = | |
function(url, id, inTextOption) { | |
if (d.getElementById(id)) { return; } | |
js = d.createElement(s); js.src = url; js.id = id; | |
if (typeof inTextOption !== "undefined" && inTextOption.length) { | |
try { js.text = inTextOption; } // in try because .text="string" fails in Opera | |
catch (e) { js.innerText = inTextOption; } // for Opera |
This file contains hidden or 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
<script> | |
// Credit to: | |
// Original function adapted from Facebook async script at - http://www.phpied.com/social-button-bffs/ | |
// http://twitter.com/aaronpeters | |
// http://www.aaronpeters.nl/blog/why-loading-third-party-scripts-async-is-not-good-enough | |
(function(w, d, s) { | |
function go(){ | |
var js, fjs = d.getElementsByTagName(s)[0], load = function(url, id, cb) { | |
if (d.getElementById(id)) {return;} | |
js = d.createElement(s); js.src = url; js.id = id; |
This file contains hidden or 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 swipeFunc = { | |
touches : { | |
"touchstart": {"x":-1, "y":-1}, | |
"touchmove" : {"x":-1, "y":-1}, | |
"touchend" : false, | |
"direction" : "undetermined" | |
}, | |
touchHandler: function(event) { | |
var touch; | |
if (typeof event !== 'undefined'){ |
NewerOlder