Skip to content

Instantly share code, notes, and snippets.

View yadomi's full-sized avatar
😏
Getting spaghettified in a wormhole

Felix Yadomi yadomi

😏
Getting spaghettified in a wormhole
  • France
View GitHub Profile
(function(){
debugger;
})()
const express = require('express');
const app = express();
const port = 3000;
const bodyParser = require('body-parser').json({ limit: '40mb' });
function responseTime(req, res, next) {
const start = process.hrtime();
res.on('finish', () => {
@yadomi
yadomi / error_to_string_key_value.js
Created March 9, 2020 13:03
Error to key value message
const escape = value => {
const hasSpace = /\s/.test(value);
const hasNewLine = /\\n/.test(value);
return hasSpace || hasNewLine ? JSON.stringify(value) : value
}
const toKeyValue = (key, value) => {
return `${key}=${escape(value)}`
}
@yadomi
yadomi / package.json
Created February 27, 2020 16:34
Hapi querystring issues
{
"dependencies": {
"@hapi/hapi": "^19.1.1",
"@hapi/joi": "^17.1.0",
"qs": "^6.9.1"
}
}
// generated by quake, do not modify
unbindall
bind TAB "+scores"
bind ENTER "+button2"
bind ESCAPE "togglemenu"
bind SPACE "+moveup"
bind + "sizeup"
bind - "sizedown"
bind / "weapnext"
bind 0 "weapon 10"
@yadomi
yadomi / Animated.js
Created December 4, 2017 21:26
React Tweened State Component
import React, { Component } from 'react';
import TweenComponent from './TweenComponent';
export default class Animated extends TweenComponent {
state = {
x: 0,
y: 0,
scale: 1,
};
@yadomi
yadomi / suicidehunt.js
Last active November 7, 2016 14:05
Sucide Tabs ProductHunt
javascript:Array.from(document.querySelectorAll('[data-source-name="productHunt"]')).forEach((a) => a.click())
@yadomi
yadomi / departements.json
Last active January 17, 2016 21:17
JSON Endpoint for Meteo France Vigilance map (running live at https://meteo-vigilance.herokuapp.com/)
[{
"name": "Aisne",
"number": "02"
}, {
"name": "Marne",
"number": "51"
}, {
"name": "Pas-de-Calais",
"number": "62"
}, {
@yadomi
yadomi / slack-emoji-bomb.js
Last active January 17, 2016 00:47
Randomly send an emoji every .5s
//Insert any smiley you want here
var emoji = [":bowtie:", ":smile:", ":laughing:", ":blush:", ":smiley:"]
var interval = setInterval(function(){
var em = emoji[Math.floor(Math.random()*emoji.length)];
$('#message-input').val(em);
$('#message-form').submit();
}, 500);
@yadomi
yadomi / Makefile
Created December 5, 2015 16:35
Simple Makefile for easy ES6 transpilation with babel
LIBS := $(wildcard lib/*.js)
SOURCE_JS := inject.es6
BUILD_JS := dist/inject.min.js
SOURCE_CSS := inject.css
BUILD_CSS := dist/inject.min.css
UGLIFYJS := ./node_modules/uglify-js/bin/uglifyjs
BABEL := ./node_modules/babel-cli/bin/babel.js