Skip to content

Instantly share code, notes, and snippets.

View thebiltheory's full-sized avatar
🎯
Focusing

Nabil thebiltheory

🎯
Focusing
View GitHub Profile

FORMAT:

<type>[optional scope]: <description>

[optional body]

[optional footer]
@thebiltheory
thebiltheory / image_optimization.md
Created June 12, 2019 15:13
Image Optimization

Optimize Images

  • Status: [proposed]
  • Deciders: [Hakim, Omar, Felix, Bil]
  • Date: [2019-06-13]

Technical Story: [description | ticket/issue URL]

Context and Problem Statement

import parse from "html-react-parser";
import DOMPurify from "dompurify";
export default function parseHtml(response) {
if (response) {
const dirty = response;
const clean = DOMPurify.sanitize(dirty);
return parse(clean);
}
}
{
"currency":"EUR",
"deals":[
{
"transport":"train",
"departure":"London",
"arrival":"Amsterdam",
"duration":{
"h":"05",
"m":"00"
@thebiltheory
thebiltheory / curry.js
Created December 19, 2017 14:21
Add some curry to your functions
let curry = function (tocurry) {
const params = Array.prototype.slice.call(arguments, 1);
return function () {
return tocurry.apply(this, params.concat(
Array.prototype.slice.call(arguments, 0)
));
};
};
@thebiltheory
thebiltheory / README-Template.md
Created December 4, 2017 05:24 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@thebiltheory
thebiltheory / PriorityQueue.js
Created November 5, 2017 13:51
A minimal implementation of a priority queue. All I needed.
/** Minimalist Priority Queue. */
export default class PriorityQueue {
constructor() {
this.nodes = [];
}
/**
* Enqueue a new element to the Queue
* @param {value} key value of the key item
* @param {number} priority set the priority of the item
@thebiltheory
thebiltheory / gulpfile.js
Last active October 6, 2017 10:19
A base gulp file that with margin for improvement.
/*=====================================*\
Trippy Build Tasks
\*=====================================*/
/*
* TODO: Optimize build process to inject HTML & Javascript with browserSync
*/
const gulp = require('gulp');
const scss = require('gulp-sass');
@thebiltheory
thebiltheory / Singleton.js
Last active September 18, 2017 09:48
Singleton example
/**
* Singleton Pattern
* @returns {Object}
*/
let Planet;
{
let instance;
Planet = function () {
@thebiltheory
thebiltheory / getCoordinates.js
Created September 12, 2016 16:23
Get the browser geolocation
var getCoords = function (options) {
return new Promise(function (resolve, reject) {
navigator.geolocation.getCurrentPosition(resolve, reject, options);
});
}
var geo_options = {
enableHighAccuracy: true,
maximumAge : 30000,
timeout : 27000