Skip to content

Instantly share code, notes, and snippets.

View livingston's full-sized avatar

Livingston Samuel livingston

View GitHub Profile
<!DOCTYPE html>
<!--
__ __ ___ ___ __
| | | | \ \ / / | |
| | | | \ \ / / | |
| |____ | | \ \/ / | |
|_______| |__| \____/ |__|
HAND CODED BY LIVINGSTON SAMUEL
-->
<html lang='en'>
// original (http://html5shiv.googlecode.com/svn/trunk/html5.js)
(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,canvas,datalist,details,figure,figcaption,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,summary,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})()
// kangax version (29 characters less, yay!)
/*@cc_on(function(e,i){i=e.length;while(i--)document.createElement(e[i])})("abbr,article,aside,audio,canvas,datalist,details,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(','))@*/
@livingston
livingston / gist:494520
Last active September 5, 2015 12:45
Browser Bugs

Internet Explorer

  • Create elements dynamically along with attributes using document.createElement

        document.createElement('<div id="wrapper" class="global">')
    

    This will create a div with the attributes id and class set. So the resulting element's html would look like,

        <div id=wrapper class=global></div>
    
@livingston
livingston / js1k-squares.js
Created August 9, 2010 10:43
Entry for JS1K Contest
/*! Animated Squares
*
* @author Livingston Samuel
* @license MIT License
* @url - http://gist.github.com/515271
* Modified version of Squares - http://github.com/livingston/Squares
* Original idea by squaredesign - http://squaredesign.com/lab/crazy-squares/
*
*/

iPhone 3.1.2 Webkit 528.18 Safari 528.16

  • -webkit-border-radius cannot be larger than the set/inherited font-size value
@livingston
livingston / git-tools.sh
Created August 21, 2010 17:01
GIT Tools
#!/usr/bin/sh
#Short command to clone a git repository
## USAGE: gc git://github.com/livingston/rotator.git
## this command will clone the git repo in a folder of the format {GITHUB_USER-NAME}_{REPO-NAME}
gc()
{
str=$1
<?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>
//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]);
//String Addons
//Fastest method to reverse a string http://jsperf.com/livi-002
String.prototype.reverse = function () { return this.split('').reverse().join('') }
@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) {