Skip to content

Instantly share code, notes, and snippets.

View camille-hdl's full-sized avatar

Camille Hodoul camille-hdl

View GitHub Profile
{
"scripts": {
"build": "rollup -c --prod --mini",
"watch": "rollup -c -w",
"serve": "serve"
}
}
{
"public": "public",
"rewrites": [{ "source": "/**", "destination": "/index.html" }]
}
[ignore]
.*/node_modules/.*
.*/public/.*
.*/__tests__/.*
.*/cypress/.*
[include]
[libs]
flow-typed
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/";
{
"env": {
"production": {
"presets": [["@babel/preset-env", {
"targets": {
"browsers": [
">0.25%",
"not op_mini all"
]
}
<!-- see it in action here : https://github.com/rollup/rollup-starter-code-splitting/blob/master/public/index.html -->
<!-- Browsers with dynamic import support -->
<script type="module">
window.esDynamicImport = true;
// this will throw if dynamic import is not supported
import("/js/es/entrypoint.js").then(function(m) {
// do something
});
</script>
@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);
};
(function() {
if(!!window.history) {
var curHash = "";
var nextIndex = 0;
var setHash = function(str, title) {
curHash = str;
window.history.replaceState({}, title, '#'+str);
};
var states = ["(>°.°)>","(^°o°)^","<(°.°<)","^(°o°^)"];