Skip to content

Instantly share code, notes, and snippets.

Javier Bermúdez javilobo8

Block or report user

Report or block javilobo8

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@javilobo8
javilobo8 / download-file.js
Last active Dec 12, 2019
Download files with AJAX (axios)
View download-file.js
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
View betterpromise.js
/* 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');
}
View ocr.js
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);
View Stepper.jsx
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;
View create-reducer.js
export default function createReducer(INITIAL_STATE, handlers) {
return function reducer(state = INITIAL_STATE, action) {
if (handlers[action.type]) {
return handlers[action.type](state, action);
}
return state;
};
}
View ac-ardu.ino
#include <Adafruit_NeoPixel.h>
#include <LedControlMS.h>
// Serial
#define BAUDRATE 115200
// NeoPixel Stick
#define NP_PIN 6
#define NUM_LEDS 16
#define NEO_MAX_BRIGHTNESS 32
View api-redux-middleware.js
import axios from 'axios';
import {newNotification} from 'actions/notifications';
import filterAxiosProps from './filter-axios-props';
export const FETCH_API_ERROR = 'FETCH_API_ERROR';
export const FETCH_API = 'FETCH_API';
function checkIfItIsFunction(notification, response) {
if (typeof notification === 'function') {
return notification(response);
View TS3Dockerfile
FROM ubuntu:16.04
ENV TSV=3.0.13.8
RUN DEBIAN_FRONTEND=noninteractive \
apt-get -y update && \
apt-get -y install bzip2 && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
apt-get autoremove -y && \
apt-get clean
View PUBG VARS
USERNAME
REGION
SEASON
killDeathRatio
winRatio
roundsPlayed
wins
losses
top10s
View gist:8de8d2fc274118ad16847a176f7f9068
# Replace text in all files
sed -i -e "s/'actions'/'action-types'/g" ./src/**/**.js
You can’t perform that action at this time.