Skip to content

Instantly share code, notes, and snippets.

@blemoine
blemoine / gist:bf314f8881ea470df97ce4603a3fef06
Created February 7, 2023 20:01
Modified file for mocking location and history in JSDOM
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Originally Copy pasted from https://github.com/firefox-devtools/profiler
// And adapted in TypeScript
/**
* jsdom leaves the history in place after every test, so the history will
@blemoine
blemoine / utilities.ts
Created March 21, 2017 17:18
Lodash schortcuts in typescript
interface User {
firstName:string;
lastName:string;
age:number;
}
const user1= {firstName:"Georges",lastName:"Abitbol", age:43}
const user2 = { firstName: "Joel", lastName: "Hammond", age: 25 }
const arr: Array<User> = [user1, user2]
@blemoine
blemoine / gist:6ea25402b37e9830f6ca
Created September 9, 2015 10:07
Compressing GeoJSON with informations loss
/*
pour lancer :
node geoJsonMinifier.js <cheminDuFichierGeoJson> > <cheminDuFichierDeSorti>
*/
var fs = require('fs');
var _ = require('lodash');
var geoJsonPath = process.argv[2];
@blemoine
blemoine / gist:e6045ed93b3d90a52891
Last active May 14, 2024 15:21
Convert Lambert 93 to GPS Coordinates Latitude / Longitude (wgs84)
Math.tanh = Math.tanh || function(x) {
if(x === Infinity) {
return 1;
} else if(x === -Infinity) {
return -1;
} else {
return (Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x));
}
};