Skip to content

Instantly share code, notes, and snippets.

View javilobo8's full-sized avatar

Javier Bermúdez Lobo javilobo8

View GitHub Profile
import React, { Component } from 'react';
import styled from 'styled-components';
const orangeColor = '#FE6680';
const bubbleSize = 50;
const stepperwidth = 800;
const StepContainer = styled.div`
width: ${stepperwidth}px;
height: ${bubbleSize}px;
const Tesseract = require('tesseract.js');
const sharp = require('sharp');
const cv = require('opencv4nodejs');
const fs = require('fs');
const EROSION_SIZE = 1;
const EROSION_MODE = cv.MORPH_ERODE;
const SCALE = 2;
const ITERATIONS = 2;
const ANCHOR = new cv.Point2(EROSION_SIZE, EROSION_SIZE);
@javilobo8
javilobo8 / betterpromise.js
Created November 11, 2019 14:13
better promise
/* eslint-disable func-names, no-extend-native */
Promise.prototype.catch = function (...args) {
if (args.length === 0) {
throw new TypeError('0 arguments given');
}
if (typeof args[args.length - 1] !== 'function') {
throw new TypeError('Last argument must be a function');
}
const Discord = require('discord.js');
const bot = new Discord.Client();
var isReady = true;
async function sendAudio(connection, filepath) {
console.log('sendAudio');
return new Promise((resolve, reject) => {
const dispatcher = connection.playFile(filepath);
dispatcher.on('end', () => {
import * as d3 from 'd3';
const bgRGB = d3.rgb('#040404');
const CANVAS_WIDTH = 1600;
const CANVAS_HEIGHT = 800;
const MIN_STAR_MAG = 6;
function getRetinaRatio(ctx) {
const devicePixelRatio = window.devicePixelRatio || 1;