Skip to content

Instantly share code, notes, and snippets.

View revolunet's full-sized avatar
🐫
Killing bugz

Julien Bouquillon revolunet

🐫
Killing bugz
View GitHub Profile
@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',
class QuerySetDoubleIteration(Exception):
"A QuerySet was iterated over twice, you probably want to list() it."
pass
# "Skinny" here means we use iterator by default, rather than
# ballooning in memory.
class SkinnyManager(Manager):
def get_query_set(self):
return SkinnyQuerySet(self.model, using=self._db)
@filmaj
filmaj / gist:574501
Created September 10, 2010 22:36
Poor man's JavaScript scrolling helper for mobile devices
function PoorMansGloveBox(element) {
this.element = element;
this.parentHeight = this.element.parentNode.clientHeight;
this.element.style.position = 'relative';
this.element.style.top = '0px';
this.lastPos = 0;
this.currentPos = 0;
var self = this;
this.element.addEventListener('touchstart', function(e){
self.lastPos = e.touches[0].pageY;
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Created: 2010/12/05
// Updated: 2018/09/12
// License: MIT
//
// Copyright (c) 2010-2018 Diego Perini (http://www.iport.it)
//
@blister
blister / gist:740829
Created December 14, 2010 18:19
Bash script to add a delay to the localhost interface on Linux machines
#!/bin/bash
# Copyright 2010 Eric Ryan Harrison <me@ericharrison.info>
# Inspired by:
# http://daniel.haxx.se/blog/2010/12/14/add-latency-to-localhost/
if [ -n "$1" ]
then
if [ "$1" = "off" ]
then
tc qdisc del dev lo root
@HenrikJoreteg
HenrikJoreteg / straight_include.py
Created December 15, 2010 16:06
A Django Template tag for including files that you don't want to parse as templates
"""
Straight Include template tag by @HenrikJoreteg
Django templates don't give us any way to escape template tags.
So if you ever need to include client side templates for ICanHaz.js (or anything else that
may confuse django's templating engine) You can is this little snippet.
Just use it as you would a normal {% include %} tag. It just won't process the included text.
@Kilian
Kilian / annoying.js
Created January 6, 2011 15:04
How to be an asshole
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors
*
@mwbrooks
mwbrooks / blackberry-webworks.md
Created January 13, 2011 17:38
Overview of PhoneGap BlackBerry WebWork - original revision by filmaj

BlackBerry WebWorks & PhoneGap

WebWorks is a BlackBerry SDK that leverages Web technologies to create applications for BlackBerry 5.0, 6.0, and QNX. An application that is built with WebWorks uses HTML, CSS, and JavaScript and is called a Web widget. The structure of the application is similar to a thick-client JavaScript Web application, where JavaScript manages the model, view, and logic.

WebWorks enhances the JavaScript API to allow any Web widget application to access any Blackberry Java API. RIM includes a small WebWorks JavaScript API that allows access to some BlackBerry device features, such as invoking third-party applications. However, more importantly, WebWorks allows developers to create an Java extension that binds JavaScript and Java. This means any Java API can be accessible to JavaScript.

The WebWorks SDK uses a command-line tool called bbwp.exe (Windows-only) to create a BlackBerry-compatible application binary (.cod). Since a WebWorks application is pa

<html>
<head>
<title>WebGL Maximums</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
// MAX_COMBINED_TEXTURE_IMAGE_UNITS long