Skip to content

Instantly share code, notes, and snippets.

View j3lte's full-sized avatar

Jelte Lagendijk j3lte

View GitHub Profile
@j3lte
j3lte / mobile-debug.js
Created August 20, 2013 22:19
Javascript. Mobile debug (android), three finger touch
if( ( /android/gi ).test( navigator.appVersion ) ) {
console = {
"_log" : [],
"log" : function() {
var arr = [];
for ( var i = 0; i < arguments.length; i++ ) {
arr.push( arguments[ i ] );
}
this._log.push( arr.join( ", ") );
},
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
@j3lte
j3lte / map.geojson
Created September 3, 2013 12:57
via:geojson.io
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@j3lte
j3lte / grunt-connect-proxy-requests.js
Last active December 22, 2015 11:09
Grunt connect proxy JSON requests. Proposed solution for a problem I describe at: http://jeltelagendijk.nl/2013/09/grunt-connect-json-api-cross-domain/
// Add this at the top of Gruntfile.js:
var request = require('request');
module.exports = function(grunt) {
grunt.initConfig({
// .........
// other grunt tasks
(function( jQuery, window, undefined ) {
"use strict";
var matched, browser;
jQuery.uaMatch = function( ua ) {
ua = ua.toLowerCase();
var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
'use strict';
/**
* IE8 does not support certain Javascript functions
* These are added using this script
*/
// Add ECMA262-5 method binding if not supported natively
//
if (!('bind' in Function.prototype)) {
Function.prototype.bind= function(owner) {
/**
* j3lte namespace object.
* Creates the j3lte object without overriding previous instances of it.
*/
var j3lte = (j3lte === undefined) ? {} : j3lte;
j3lte.namespace = function () {
var a = arguments, o = null, i, j, d;
for (i = 0; i < a.length; i = i + 1) {
d = ("" + a[i]).split(".");
(function() {
var fontSize,
timeOut = null;
/**
* Start the code and add an event listener to resize. Only fire handleResize 250ms after stop resizing
* @return {void}
*/
function img2table( img ){
var canvas = document.createElement('canvas')
, ctx = canvas.getContext('2d')
, table = document.createElement('table')
, width = canvas.width = img.width
, height = canvas.height = img.height
, pixels
, i, j, l1, l2
, tr, td, r, g, b