Skip to content

Instantly share code, notes, and snippets.

View camille-hdl's full-sized avatar

Camille Hodoul camille-hdl

View GitHub Profile
@camille-hdl
camille-hdl / getPolygonBounds.js
Created October 21, 2015 07:08
Google maps API : get polygon bounds
/**
* Recupere les limites d'un polygone
*
* @method getPolygonBounds
* @param {Object} polygon un `polygon` gmap
* @return {Object} bounds
*/
getPolygonBounds: function(polygon) {
var paths = polygon.getPaths();
var bounds = new google.maps.LatLngBounds();
@camille-hdl
camille-hdl / js.stx
Last active October 20, 2022 09:22
ES6-friendly EditPlus syntax file
#TITLE=JavaScript
; JavaScript syntax file written by ES-Computing, edited by https://github.com/Eartz/ based on ECMA-262 6th Edition / Draft April 3, 2015.
; This file is required for EditPlus to run correctly.
#DELIMITER=,(){}[]-+*%/="'`~!&|<>?:;.
#QUOTATION1='
#QUOTATION2="
#QUOTATION3=`
#LINECOMMENT=//
#LINECOMMENT2=
@camille-hdl
camille-hdl / es6-throttle.js
Last active September 3, 2020 09:29
Function throttling implementation in ES6
/*
http://www.es6fiddle.net/i8d8e1um/
*/
var throttle = (func,ms=50,context=window) => {
let to;
let wait=false;
return (...args) => {
let later = () => {
func.apply(context,args);
};
language: node_js
node_js:
- "node"
- "lts/*"
addons:
apt:
packages:
# Ubuntu 16+ does not install this dependency by default, so we need to install it ourselves
- libgconf-2-4
cache:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>Rollup React example</title>
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no" />
</head>
<body>
<script>
{
"env": {
"production": {
"presets": [["@babel/preset-env", {
"targets": {
"browsers": [
">0.25%",
"not op_mini all"
]
}
import babel from "rollup-plugin-babel";
import commonjs from "rollup-plugin-commonjs";
import nodeResolve from "rollup-plugin-node-resolve";
import { terser } from "rollup-plugin-terser";
import replace from "rollup-plugin-replace";
import builtins from "rollup-plugin-node-builtins";
import globals from "rollup-plugin-node-globals";
import clear from "rollup-plugin-clear";
const outputDir = "./public/js/";
{
"scripts": {
"test": "run-s jest build testci",
"testci": "start-server-and-test serve http://localhost:5000 cypress:run",
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"cypress:install": "cypress install",
"jest": "jest"
}
}
{
"baseUrl": "http://127.0.0.1:5000",
"video": false,
}
{
"jest": {
"verbose": true,
"testRegex": "(/__tests__/.*|\\.(test|spec|react-test))\\.(js|jsx)$",
"moduleFileExtensions": [
"js"
],
"globals": {
"NODE_ENV": "test"
},