Skip to content

Instantly share code, notes, and snippets.

View livingston's full-sized avatar

Livingston Samuel livingston

View GitHub Profile
@livingston
livingston / index.html
Last active October 13, 2015 11:28 — forked from mbostock/.block
World Countries — http://bl.ocks.org/livingston/4188825
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.country {
fill: #b8b8b8;
stroke: #fff;
stroke-width: .5px;
stroke-linejoin: round;
}
@livingston
livingston / EventMonitor.js
Created September 30, 2011 12:20
Element event monitor, similar to Web Inspector's `monitorEvents`
(function (global) {
if ( !global.Event && !('keys' in Object) && !('bind' in Function) ) { return }
var eventProto = Event.prototype,
EVENTS = {
'mouse': [ 'click', 'dblclick', 'contextmenu', 'mousedown', 'mouseup', 'mouseover', 'mousemove', 'mouseout', 'drag', 'dragend', 'dragenter', 'dragleave', 'dragover', 'drop'],
'key': [ 'keydown', 'keypress', 'keyup', 'input'],
'res': [ 'load', 'unload', 'beforeunload', 'abort', 'error', 'resize', 'scroll', 'readystatechange' ],
'form': [ 'select', 'change', 'submit', 'reset', 'focus', 'blur' ],
'ui': [ 'DOMFocusIn', 'DOMFocusOut', 'DOMActivate', 'DOMCharacterDataModified', 'DOMNodeInserted', 'DOMNodeRemoved', 'DOMSubtreeModified' ],
<!DOCTYPE html>
<!-- Helpful things to keep in your <head/>
// Brian Blakely, 360i
// http://twitter.com/brianblakely/
-->
<head>
<!-- Disable automatic DNS prefetching.
@livingston
livingston / render_frame.js
Created July 12, 2011 21:55
Beautified render_frame.js
(function() {
function i(a) {
throw a;
}
var j = void 0,
q = null,
s;
function aa(a) {
this.t = {};
this.tick = function(a, c, d) {
function getTarget (e) {
var targ;
e = e || window.event;
targ = e.target || e.srcElement;
return (targ.nodeType == 3)? targ.parentNode : targ;
}
/* Parses JSON with function body as a string into JavaScript object */
var parseJSONwithFunctions = function (JSONdata) {
var root = document.documentElement,
sandbox = document.createElement('script'),
code = "var fn = {", i;
for (i in JSONdata) {
if( JSONdata.hasOwnProperty(i) ) {
code += i + " : " + JSONdata[i] + ",";
@livingston
livingston / ES5 Extend & Clone Objects.js
Created February 1, 2011 10:00
ES5 Extend & Clone Objects
Object.defineProperties(Object, {
'extend': {
'configurable': true,
'enumerable': false,
'value': function extend(what, wit) {
var extObj, witKeys = Object.keys(wit);
extObj = Object.keys(what).length ? Object.clone(what) : {};
witKeys.forEach(function (key) {
//String Addons
//Fastest method to reverse a string http://jsperf.com/livi-002
String.prototype.reverse = function () { return this.split('').reverse().join('') }
//Simple tabs with Book-markable urls
var handleTabs = (function (tabHandles) {
if (!tabHandles || !(/[\s]*hasTabs[\s]*/.test(tabHandles.className))) {
return function () {}
}
var tabHandleParent = $(tabHandles.parentNode),
activeClass = 'active',
activateTab = function activateTab(tab) {
var currentTab = $(tab ? document.getElementById(tab) : tabHandles.getElementsByTagName('a')[0]);
<?xml version="1.0"?>
<ArrayOfPreset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Preset>
<Name>iPad and iPhone 4 - Standard Definition</Name>
<Query> -f mp4 -w 640 -l 480 -e x264 -b 2048 -a 1 -E faac -6 stereo -R 48 -B 160 -D 0.0 -x ref=2:bframes=2:subq=6:mixed-refs=0:weightb=0:8x8dct=0:trellis=0 -v 1</Query>
<PictureSettings>false</PictureSettings>
<Version>0.9.4</Version>
</Preset>