Skip to content

Instantly share code, notes, and snippets.

View kekscom's full-sized avatar

Jan Marsch kekscom

View GitHub Profile
@kekscom
kekscom / gist:6829920
Created October 4, 2013 17:54
soldner to wgs84 for soldner coordinates 26197,19294
var proj = require("proj4");
proj.defs("EPSG:3068", "+proj=cass +lat_0=52.41864827777778 +lon_0=13.62720366666667 +x_0=40000 +y_0=10000 +ellps=bessel +datum=potsdam +units=m +no_defs");
console.log(proj("EPSG:3068", "WGS84", [26197,19294]));
@kekscom
kekscom / gist:5367764
Created April 11, 2013 22:38
hatching test in canvas, see it in action: http://jsfiddle.net/S5aAY/
// <canvas>
var w = 600, h = 300;
var canvas = document.getElementsByTagName('CANVAS')[0];
canvas.width = w;
canvas.height = h;
var context = canvas.getContext('2d');
@kekscom
kekscom / gist:5053306
Last active May 11, 2025 06:35
JavaScript toLocalISOString() function
function toLocalISOString(d) {
var off = d.getTimezoneOffset();
return new Date(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes() - off, d.getSeconds(), d.getMilliseconds()).toISOString();
}
@kekscom
kekscom / Thick Line to Polygon JS
Created December 3, 2012 10:43
A JavaScript method to turn thick lines into polygons
/**
* @author Jan Marsch (@kekscom)
* @example see http://jsfiddle.net/osmbuildings/2e5KX/5/
* @example thickLineToPolygon([{x:50,y:155}, {x:75,y:150}, {x:100,y:100}, {x:50,y:100}], 20)
* @param polyline {array} a list of point objects in format {x:75,y:150}
* @param thickness {int} line thickness
*/
var thickLineToPolygon = (function () {
function getOffsets(a, b, thickness) {
@kekscom
kekscom / BulkInsert.js
Created July 9, 2012 19:54
MySQL bulk Insert
/**
This little helper creates bulk SQL insert queries like this:
INSERT INTO mytable (id, col1, col2) VALUES
(1, "col1value", "col2value"),
(2, "col1value", "col2value"),
(3, "col1value", "col2value"),
:
:
(4999, "col1value", "col2value"),