Skip to content

Instantly share code, notes, and snippets.

View jfsiii's full-sized avatar

John Schulz jfsiii

View GitHub Profile
define('components/ui/add_profile', function(require) {
'use strict';
/**
* Module dependencies
*/
// var defineComponent = require('flight/lib/component');
// Using flight global from standalone lib for demo purposes.
var defineComponent = flight.component;
@jfsiii
jfsiii / index.js
Created July 23, 2014 01:45 — forked from Matt-Esch/index.js
requirebin sketch
var diff = require('virtual-dom/diff');
var patch = require('virtual-dom/patch');
var createElement = require('virtual-dom/create-element');
var virtualize = require('vdom-virtualize');
// 1: Create a function that declares what the DOM should look like
function render(count) {
var html = '<div id="test">Count is <span>' + count + '</span></div>';
return virtualize.fromHTML(html);
}
// jquery invert plugin
// by paul irish
// some (bad) code from this css color inverter
// http://plugins.jquery.com/project/invert-color
// some better code via Opera to inverse images via canvas
// http://dev.opera.com/articles/view/html-5-canvas-the-basics/#insertingimages
// and some imagesLoaded stuff from me
// http://gist.github.com/268257
/*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(){
var UPC_SET = {
"3211": '0',
"2221": '1',
"2122": '2',
/*! Cross-browser-compatible async
*
* I took Mathias' setZeroTimeout and changed it to async, based on http://fitzgeraldnick.com/weblog/35/. Some style changes (varible names, show logic first).
*
* I took the original setZeroTimeout and made it cross-browser-compatible, using setTimeout(fn, 0) as a fallback in case postMessage is not supported.
* Mathias Bynens <http://mathiasbynens.be/>
* See <http://mathiasbynens.be/notes/settimeout-onload>
*
* Copyright statement below:
*
/*! Cross-browser-compatible setZeroTimeout
*
* I took the original setZeroTimeout and made it cross-browser-compatible, using setTimeout(fn, 0) as a fallback in case postMessage is not supported.
* Mathias Bynens <http://mathiasbynens.be/>
* See <http://mathiasbynens.be/notes/settimeout-onload>
*
* Copyright statement below:
*
* See <http://dbaron.org/log/20100309-faster-timeouts>
* By L. David Baron <dbaron@dbaron.org>, 2010-03-07, 2010-03-09
// converts milliseconds to '3:45' or if hours > 0, '2:01:23'
var getTimeFromMillis = function( ms )
{
var seconds = ':' + twoDigit( ~~( ( ms / 1000 ) % 60 ) ),
minutes = ~~( ( ms / ( 1000 * 60 ) ) % 60 ),
hours = ~~( ( ms / ( 1000 * 60 * 60 ) ) );
function twoDigit( n ) { return n < 10 ? '0' + n : n; }
return hours > 0 ? hours + ':' + twoDigit( minutes ) + seconds : minutes + seconds;
@jfsiii
jfsiii / dual.js
Created May 13, 2011 03:01 — forked from unscriptable/another-way.js
AMD-compatible CommonJS Module/1.1 that can also be loaded in a script tag
(function (define) {
define(function (exports) {
function Color(){}
return Color;
});
}(
// provide define if it's not available
this.define || (function (global, moduleId) {
@jfsiii
jfsiii / dual.js
Created May 13, 2011 03:22 — forked from unscriptable/another-way.js
AMD-compatible CommonJS Module/1.1 that can also be loaded in a script tag
(function () {
/*!
* expose.js
*
* @author Oleg Slobodskoi
* @website https://github.com/kof/expose.js
* @licence Dual licensed under the MIT or GPL Version 2 licenses.
*/
function expose(namespace, api) {
var env = {};
@jfsiii
jfsiii / index.html
Created January 10, 2012 17:51 — forked from joubertnel/gist:870190
HTML5 Canvas - Rendering of Text on high-DPI screens
<html>
<head>
<script src='http://code.jquery.com/jquery-1.5.1.min.js'></script>
</head>
<body>
<h2>Naive canvas</h2>
<canvas id="naive" width="400" height="50"></canvas>
<h2>High-def Canvas</h2>