Skip to content

Instantly share code, notes, and snippets.

View bkardell's full-sized avatar

Brian Kardell bkardell

View GitHub Profile
@bkardell
bkardell / gist:7128131
Last active December 26, 2015 09:19
WIP..
define([], function () {
function injectStyle(css) {
var st = document.createElement('style');
/* If you got here it is before anything is drawn -
Add a rule to hide it until it is widgetized...
*/
var head = document.getElementsByTagName('head')[0];
try {
st.innerHTML = css;
@bkardell
bkardell / DOMModificationTargets.html
Last active December 26, 2015 05:49
DOMModificationTargets idea for sharing ...
<!DOCTYPE html>
<html>
<head>
<style>
html, body { height: 100%; width: 100%; }
pre {
padding: 1em;
border: 1px solid gray;
@bkardell
bkardell / minimal-console.js
Created September 29, 2013 01:46
Your browser's console api now minimally conforms :-p
(function(){
var noOp = function(){};
var methods = [
'assert','clear','count','debug','dir','dirxml','error','exception',
'group', 'groupCollapsed', 'groupEnd', 'info', 'isIndependentlyComposed',
'log', 'profile', 'profileEnd', 'timeEnd', 'timeStamp', 'trace', 'warn'
];
methods.forEach(function (name) {
if( !console[name] ) {
console[name] = noOp;
<!DOCTYPE html>
<html>
<head>
<title>simple</title>
<script src="https://rawgithub.com/x-tag/core/master/dist/x-tag-core.js"></script>
<script>
xtag.register("x-test", {
lifecycle: {
/* "Whenever a tag is recognized and parsed on load"... This won't fire in this test. */
created: function () {
@bkardell
bkardell / FFDevToolsOutput
Last active December 23, 2015 00:09
appcache woes
Manifest URI: http://127.0.0.1/~bkardell/iframes/child.appcache
URI http://127.0.0.1/~bkardell/iframes/file1.js is referenced in multiple locations. This is not allowed: [{"line":7,"section":"CACHE","original":"file1.js"},{"line":11,"section":"NETWORK","original":"file1.js"}].
NETWORK section line 11 (file1.js) prevents caching of line 7 (file1.js) in the CACHE section.
NETWORK section line 11 (file1.js) prevents caching of line 11 (file1.js) in the NETWORK section.
NETWORK section line 12 (file2.js) prevents caching of line 12 (file2.js) in the NETWORK section.
The file http://127.0.0.1/~bkardell/iframes/file2.js was modified after http://127.0.0.1/~bkardell/iframes/child.appcache. Unless the text in the manifest file is changed the cached version will be used instead at line 12.
NETWORK section line 13 (jquery.min.js) prevents caching of line 13 (jquery.min.js) in the NETWORK section.
<!doctype html>
<html>
<head>
<title>Test</title>
<script src="../oasis/javascript/oasis.js.html"></script>
</head>
<body>
<textarea rows="40" cols="80" id="results"></textarea>
@bkardell
bkardell / BufferedParseObserver.html
Last active December 22, 2015 09:38
demo for discussion
<!doctype html>
<html>
<head>
<link type="text/promised-json"
data-src="https://rawgithub.com/gnip/764239/raw/6c6a2297f3e4e29a626f07db0c57b45af7d7e5d7/Twitter+%28json+format%29.js"
data-promise="my.twitter.data">
<link type="text/promised-script"
data-src="https://rawgithub.com/wycats/handlebars.js/1.0.0/dist/handlebars.js"
@bkardell
bkardell / example.html
Last active December 21, 2015 23:19
pre-domcontentloaded callbacks example
<!DOCTYPE html>
<html>
<head>
<script>
var start = Date.now(),
live,
contentLoaded,
report = function (str, cb) {
console.log(str);
@bkardell
bkardell / worker.js
Last active December 20, 2015 20:19
var results = [];
function resultReceiver(event) {
results.push(parseInt(event.data));
if (results.length == 2) {
postMessage(results[0] + results[1]);
}
}
function errorReceiver(event) {
<html>
<head>
<style>
@keyframes nodeInserted {
from {
clip: rect(1px, auto, auto, auto);
}
to {
clip: rect(0px, auto, auto, auto);
}