Skip to content

Instantly share code, notes, and snippets.

View j3lte's full-sized avatar

Jelte Lagendijk j3lte

View GitHub Profile
/**
* 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(".");
'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) {
(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 ) ||
@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
@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.
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 / 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( ", ") );
},
* [AdvancedNewFile](https://github.com/skuroda/Sublime-AdvancedNewFile)
* [AngularJS](https://github.com/angular-ui/AngularJS-sublime-package)
* [AngularJS (CoffeeScript)](https://github.com/Iristyle/Sublime-AngularJS-Coffee-Completions)
* [AngularJS Snippets](https://github.com/maxhoffmann/angular-snippets)
* [ApplySyntax](https://github.com/facelessuser/ApplySyntax)
* [Automatic Backups](https://github.com/joelpt/sublimetext-automatic-backups)
* [BracketHighlighter](https://github.com/facelessuser/BracketHighlighter)
* [ChangeQuotes](https://github.com/colinta/SublimeChangeQuotes)
* [Clipboard History](https://github.com/kemayo/sublime-text-2-clipboard-history)
* [Coffee Formatter](https://github.com/derekchiang/Sublime-CoffeeScript-Formatter)

Step 1: Clone the bundles into your Sublime Text packages directory

cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
git clone git://github.com/jashkenas/coffee-script-tmbundle CoffeeScript
git clone https://github.com/miksago/jade-tmbundle.git Jade
git clone https://github.com/LearnBoost/stylus.git Stylus

Step 2: Restart Sublime Text 2

@j3lte
j3lte / index.js
Last active December 19, 2015 18:28
Part of routes/index.js in https://github.com/j3lte/node-mandelbrot
var Canvas = require('canvas');
function Mandeliter(cx, cy, maxiter)
{
var i;
var x = 0.0;
var y = 0.0;
for (i = 0; i < maxiter && x*x + y*y <= 4; ++i)
{
var tmp = 2*x*y;