I hereby claim:
- I am leekad on github.
- I am leekad (https://keybase.io/leekad) on keybase.
- I have a public key ASD82aADiaukhyuUPvfQcumHuvEeHkbaFuifcJmbuU48zAo
To claim this, I am signing this object:
{ | |
"Ansi 3 Color" : { | |
"Red Component" : 0.94509804248809814, | |
"Color Space" : "Calibrated", | |
"Blue Component" : 0.54901963472366333, | |
"Alpha Component" : 1, | |
"Green Component" : 0.98039215803146362 | |
}, | |
"Tags" : [ |
I hereby claim:
To claim this, I am signing this object:
// Dead simple functions | |
const curry = fn => (...args) => fn.bind(null, ...args); | |
const map = curry((fn, arr) => arr.map(fn)); | |
const join = curry((str, arr) => arr.join(str)); | |
const split = curry((splitOn, str) => str.split(splitOn)); | |
// keyBy :: String -> Array -> Object | |
const keyBy = curry((keyField, arr) => | |
Object.assign({}, ...arr.map(item => ({[item[keyField]]: item})))); |
var image = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream"); | |
var link = document.getElementById('link'); | |
link.setAttribute('download', 'result.png'); | |
link.setAttribute('href', image); | |
link.click(); |
const canvas = document.getElementById('canvas'); | |
const ctx = canvas.getContext('2d'); | |
const image = new Image(60, 150); | |
image.onload = drawImageActualSize; | |
image.src = 'https://mdn.mozillademos.org/files/5397/rhino.jpg'; | |
function drawImageActualSize() { | |
canvas.width = this.naturalWidth; | |
canvas.height = this.naturalHeight; |
function injectJS(id: string, src: string): Promise<string> { | |
return new Promise<string>((resolve, reject) => { | |
if (!document) { | |
resolve(); | |
return; | |
} | |
if (document.getElementById(id)) { | |
resolve('JS already loaded.'); | |
return; |
import React, {useCallback, useEffect} from 'react' | |
import {createMachine, invoke, reduce, state, transition} from 'robot3' | |
import {useMachine} from 'react-robot' | |
import { curry, apply } from 'ramda' | |
// Behaviours | |
const loadFabricJS = () => import('fabric') | |
const addRect = (ctx, ev) => { | |
const {canvas} = ctx |
Schema Registry Editor | |
Inactive | |
focus -> Active | |
Active | |
showHelper -> Active | |
createSchema -> Editable | |
Editable | |
createField -> Editable | |
deleteField -> Editable | |
updateField -> Editable |
const filterBy = (conditions, index = 0) => (value) => { | |
if(conditions[index] === undefined) return value | |
if(!conditions[index](value)) return | |
return filterBy(conditions, index + 1)(value) | |
} | |
const values = [1, 2, 3, 4, 5, 6, 7, 8, 9 , 10, 25, 27] | |
const odd = (value) => value % 2 !== 0 | |
const greaterThan3 = (value) => value > 3 | |
const canDivide3 = (value) => value % 3 === 0 |
const getAllCombinations = (arraysToCombine) => { | |
const divisors = []; | |
let permsCount = 1; | |
for (let i = arraysToCombine.length - 1; i >= 0; i--) { | |
divisors[i] = divisors[i + 1] ? divisors[i + 1] * arraysToCombine[i + 1].length : 1; | |
permsCount *= (arraysToCombine[i].length || 1); | |
} | |
const getCombination = (n, arrays, divisors) => arrays.reduce((acc, arr, i) => { | |
acc.push(arr[Math.floor(n / divisors[i]) % arr.length]); |