Skip to content

Instantly share code, notes, and snippets.

View lucasmrdt's full-sized avatar

Lucas Marandat lucasmrdt

  • Dauphine
  • Paris
View GitHub Profile
@lucasmrdt
lucasmrdt / remove-events.js
Created June 10, 2019 08:19
Remove all events of type of DOM element
const removeAllEventsOf = (element, eventType) => (
(getEventListeners(element)[eventType] || []).forEach(e => (
element.removeEventListener(eventType, e.listener)
))
)

Endpoint

https://intra.epitech.eu/user/lucas.marandat@epitech.eu/netsoul/?format=json

Script

from Epitech Script

function proceed_time(json) {
    var time_tmp = 0;
    var time_tmp2 = 0;
    var time = new Array();
@lucasmrdt
lucasmrdt / ReactContext.js
Created October 29, 2018 16:34
Optimized, easy and simple context usage between Components.
// @flow
import React from "react";
type UpdaterType = () => void;
type GlobalListenersType = { [key: string]: UpdaterType };
type ScopedListenersType = { [props: string]: Set<UpdaterType> };
/**
* eg.
@lucasmrdt
lucasmrdt / interpolateColor.js
Last active September 26, 2018 11:39
Get interpolated color between two other.
const parseHexColor = hexColor => hexColor
.match(/(?=#)?\w{2}/g)
.map(c => parseInt(c, 16));
/**
* @param {string} beginColor eg. #FFFFFF must have 6 chars.
* @param {*} endColor eg. #000000 must have 6 chars.
* @param {*} percent must ∈ [0, 1].
*/
const interpolateColor = (beginColor, endColor, percent) => {
@lucasmrdt
lucasmrdt / urlEncode.js
Created May 23, 2018 23:36
[Javascript ES6] URLencode Object
const urlEncode = (obj) => [...Object.keys(obj)].map(key => key + '=' obj[key]).join('&')