This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>JPG to PNG</title> | |
<style type="text/css"> | |
body { | |
margin: 0; | |
padding: 0; | |
height: 100%; | |
text-align: center; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.bind = Function.prototype.bind || function() { | |
var args = Array.prototype.slice.call(arguments); | |
var context = args[0]; | |
var fn = this; | |
return function() { | |
var fnArgs = Array.prototype.slice.call(arguments); | |
fn.apply(context, args.slice(1).concat(fnArgs)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GOTO: https://deliveroo.co.uk/restaurants/london/balham?postcode=SW120PJ&day=today&time=ASAP&tags=noodles | |
(function createCustomScroller() { | |
var slider = document.querySelector('.contextual-link-bar--group-link-list'); | |
var sliderParent = slider.parentNode; | |
var sliderWrapper = document.createElement('div'); | |
sliderWrapper.style.background = '#fff'; | |
sliderWrapper.style.border = 'solid 1px rgba(0,0,0,0.2)'; | |
sliderWrapper.style.boxShadow = '0 4px 0 0 rgba(0,0,0,0.04)'; | |
sliderWrapper.style.overflow = 'hidden'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Map.prototype.toObject = Map.prototype.toObject || function() { | |
const result = new Object(); | |
for (let entry of this.entries()) { | |
result[entry[0]] = entry[1]; | |
} | |
return result; | |
}; | |
Object.prototype.toMap = Object.prototype.toMap || function() { | |
const result = new Map(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function.prototype.curry = Function.prototype.curry || function(arity) { | |
const fn = this; | |
const fnLength = arity || fn.length; | |
const curried = (...thisArgs) => { | |
if (thisArgs.length < fnLength) { | |
return fn.bind(null, ...thisArgs).curry(fnLength - thisArgs.length); | |
} | |
return fn(...thisArgs); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import R from 'ramda'; | |
const createOutlierFilter = (minMaxValues) => { | |
const { min, max } = minMaxValues; | |
return R.filter(value => value < min || value > max); | |
}; | |
const calculateQuartiles = (data) => { | |
const q1Index = Math.floor(data.length / 4); | |
const q3Index = Math.ceil(data.length * 0.75); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Cool search</title> | |
<style type="text/css"> | |
@import url('https://fonts.googleapis.com/css?family=Fira+Sans'); | |
body { | |
margin: 0; | |
padding: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function downloadVideoScreenshot(videoEl, filename = 'screehshot.png') { | |
const canvas = document.createElement('canvas'); | |
const context = canvas.getContext('2d') | |
const { width, height } = getComputedStyle(videoEl); | |
// Canvas attributes | |
canvas.width = width.replace('px', ''); | |
canvas.height = height.replace('px', '') | |
canvas.display = 'none'; | |
canvas.style.position = 'relative'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arrayWithoutFastest = (() => { | |
const isArray = canBeArray => ('isArray' in Array) | |
? Array.isArray(canBeArray) | |
: Object.prototype.toString.call(canBeArray) === '[object Array]'; | |
let mapIncludes = (map, key) => map.has(key); | |
let objectIncludes = (obj, key) => key in obj; | |
let includes; | |
function arrayWithoutFastest(arr, ...thisArgs) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function arrayWithoutConcatReducer(arr, ...thisArgs) { | |
const isArray = canBeArray => ('isArray' in Array) | |
? Array.isArray(canBeArray) | |
: Object.prototype.toString.call(canBeArray) === '[object Array]'; | |
const withoutValues = isArray(thisArgs[0]) ? thisArgs[0] : thisArgs; | |
return arr.reduce((acc, value) => (([1].indexOf(value) === -1) ? acc.concat(value) : acc), []) | |
} | |
function arrayWithoutPushReducer(arr, ...thisArgs) { |