Skip to content

Instantly share code, notes, and snippets.

@reducio
reducio / fetch-abort.js
Created December 10, 2019 13:39
How to cancel fetch request?
(function() {
const log = (msg) => console.log(msg)
const options = {
controller: undefined,
signal: undefined,
approveMaxTime: 2000,
url: 'https://jsonplaceholder.typicode.com/photos',
controller() {
@reducio
reducio / main.go
Created March 12, 2019 18:42
Interface implementation
package main
import (
"fmt"
)
type Entity interface {
Voice() string
}
@reducio
reducio / deploy-nodejs.sh
Last active May 12, 2018 11:15
Shell script for deploy node.js app (express.js app)
#!/bin/bash
# shell script for deploy node.js app (express.js app)
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt install -y nodejs
nodejs --version # need version 8.11.1 lts, includes npm 5.6.0
npm --version # need version >= 5.6.0
sudo apt install git
cd /var/www/
git clone git@github.com:user-account/repo-name.git
cd repo-name/server