Skip to content

Instantly share code, notes, and snippets.

View tobitailor's full-sized avatar

Tobias Schneider tobitailor

View GitHub Profile
(function(){ if(false) var window; return window }()) === window // false
var a = [];
for(var i = 0; i < 1000; i++){ a[i] = i; }
var a = [];
for(var i = 0; i < 1000; i++){ a.push(i); }
@tobitailor
tobitailor / get_barcode_from_image.js
Created June 1, 2010 19:33
Barcode recognition with JavaScript - Demo: http://bit.ly/djvUoy
/*
* 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',
@tobitailor
tobitailor / def.js
Created July 13, 2010 23:32
Simple Ruby-style inheritance for JavaScript
/*
* def.js: Simple Ruby-style inheritance for JavaScript
*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*
*
* Example:
*
* def ("Person") ({
/*
* def.js: Simple Ruby-style inheritance for JavaScript
*
* Copyright (c) 2010 Tobias Schneider
* This script is freely distributable under the terms of the MIT license.
*/
(function(global) {
__super__ = function(){
var caller = __super__.caller;
def ("SlideStreamer") ({
init: function(url){
var0 = url; // global variable
this.var1 = url; // public variable
var var2 = url; // private variable
this.next = function(){
alert("Public function..\nvar0 = " + var0); // "timing.xml"
@tobitailor
tobitailor / LICENSE.txt
Created May 23, 2011 11:33 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@tobitailor
tobitailor / history_navigation.js
Created August 23, 2011 10:34
A simple JavaScript that lets you use your browser's back/forward buttons for in-page navigation by adding custom 'next' and 'previous' events to the window object.
/*
* Lets you use your browser's back/forward buttons for in-page navigation by
* adding custom 'next' and 'previous' events to the window object.
*
* Copyright (c) 2011 Tobias Schneider <schneider@jancona.com>
* This script is freely distributable under the terms of the MIT license.
*
* Example:
*
* window.addEventListener('next', function(){
@tobitailor
tobitailor / index.html
Created May 14, 2012 12:57
How to implement synchronous(ish) Web Worker tasks in Firefox, using JS1.7 Generators.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script type="application/javascript;version=1.7">
var worker = new Worker('worker.js');
var g;