Skip to content

Instantly share code, notes, and snippets.

@mgrandrath
mgrandrath / pseudo-container.css
Last active December 15, 2015 00:59
Silent classes for pseudo elements as icon containers
.foo, .bar {
position: relative;
}
.foo:before, .bar:after {
position: absolute;
content: "";
display: block;
}
void function() {//closure
var global = this
, _initKeyboardEvent_type = (function( e ) {
try {
e.initKeyboardEvent(
"keyup" // in DOMString typeArg
, false // in boolean canBubbleArg
, false // in boolean cancelableArg
, global // in views::AbstractView viewArg
@mgrandrath
mgrandrath / gist:3838530
Created October 5, 2012 07:20
escapeHTML (AMD)
define(function() {
var entityMap = {
"&": "&",
"<": "&lt;",
">": "&gt;",
'"': '&quot;',
"'": '&#39;',
"/": '&#x2F;'
};
@mgrandrath
mgrandrath / normalized.html
Created July 6, 2012 07:16 — forked from scottkellum/normalized.html
pixel normalization
<!doctype html>
<html>
<head>
<!-- Encoding -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"></meta>
function getText(node) {
if (node.nodeType === 3) {
return node.data;
}
var txt = '';
if (node = node.firstChild) do {
txt += getText(node);