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 data_uri($file, $mime) { | |
$contents=file_get_contents($file); | |
$base64=base64_encode($contents); | |
echo "data:$mime;base64,$base64"; | |
} |
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() { | |
$.getJSON( "http://smart-ip.net/geoip-json?callback=?", | |
function(data){ | |
alert( data.host); | |
} | |
); |
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
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script> |
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
/* jQuery */ | |
$("div") | |
/* native equivalent */ | |
document.getElementsByTagName("div") | |
/* jQuery */ |
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 globalID; | |
function repeatOften() { | |
$("<div />").appendTo("body"); | |
globalID = requestAnimationFrame(repeatOften); | |
} | |
$("#start").on("click", function() { | |
globalID = requestAnimationFrame(repeatOften); | |
}); | |
$("#stop").on("click", function() { | |
cancelAnimationFrame(globalID); |
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
/* Append HTML elements 8/ | |
/* jQuery */ | |
$(document.body).append("<div id='myDiv'><img src='im.gif'/></div>"); | |
/* CRAPPY native equivalent */ | |
document.body.innerHTML += "<div id='myDiv'><img src='im.gif'/></div>"; | |
/* MUCH BETTER native equivalent */ | |
var frag = document.createDocumentFragment(); |
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
// get reference to DOM element | |
var el = document.querySelector(".main-content"); | |
//----Adding a class------ | |
/* jQuery */ | |
$(el).addClass("someClass"); | |
/* native equivalent */ | |
el.classList.add("someClass"); |
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
// get reference to a DOM element | |
var el = document.querySelector(".main-content"); | |
//----Setting multiple CSS properties---- | |
/* jQuery */ | |
$(el).css({ | |
background: "#FF0000", | |
"box-shadow": "1px 1px 5px 5px red", | |
width: "100px", |
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
<meta name="twitter:card" value="summary"> | |
<meta name="twitter:site" value="@yoast"> | |
<meta name="twitter:creator" value="@michielheijmans"> |
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
<meta name="application-name" content="Greg Benner"/> | |
<meta name="msapplication-TileColor" content="#cf9910"/> | |
<meta name="msapplication-TileImage" content="2ded66ee-e5f8-4410-8d0b-9409877f5f64.png"/> |