made with esnextbin
This file contains hidden or 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 fs = require('fs'); | |
const path = require('path'); | |
const express = require('express'); | |
const multer = require('multer'); | |
const argv = require('minimist')(process.argv.slice(2)); | |
const port = argv.port || 9999; | |
const fileFolderName = argv.folder || 'files'; | |
const absolutePathToFileFolder = process.cwd() + '/' + fileFolderName; |
This file contains hidden or 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
var formidable = require('formidable') | |
var http = require('http') | |
http.createServer(function (req, res) { | |
const headers = { | |
'Content-Type': 'application/json', | |
'Access-Control-Allow-Origin': '*', | |
'Access-Control-Allow-Methods': 'OPTIONS, POST, GET', | |
'Access-Control-Max-Age': 2592000 // 30 days | |
/** add other headers as per requirement */ |
This file contains hidden or 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
var Uppy = require('uppy') | |
var uppy = new Uppy.Core({ | |
debug: true | |
}) | |
uppy.use(Uppy.DragDrop, { | |
target: '.drag' | |
}) | |
uppy.use(Uppy.ProgressBar, {target: 'body'}) | |
uppy.use(Uppy.Tus10, { |
This file contains hidden or 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
var Uppy = require('uppy') | |
var uppy = new Uppy.Core({wait: false, debug: true}) | |
uppy | |
.use(Uppy.DragDrop, {target: 'body'}) | |
.use(Uppy.Tus10, {endpoint: 'http://master.tus.io:8080/files/'}) | |
.run() | |
uppy.on('core:upload-success', (fileId, url) => { | |
console.log(url) |
This file contains hidden or 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
var tus = require('tus-js-client') | |
var input = document.querySelector('.myInput') | |
input.addEventListener("change", function(e) { | |
// Get the selected file from the input element | |
var file = e.target.files[0] | |
// Create a new tus upload | |
var upload = new tus.Upload(file, { |
- Feross’s webtorrent: https://github.com/feross/webtorrent-desktop ★
- Feather-app, WebWorker, state, actions, virtual-dom: https://github.com/HenrikJoreteg/feather-app/tree/master/src
- Nolan Lawson’s Pokedex: https://github.com/nolanlawson/pokedex.org/, http://www.pocketjavascript.com/blog/2015/11/23/introducing-pokedex-org
- Substack’s chatwizard: https://github.com/substack/chatwizard
- Substack’s simple SPA example with
virtual-dom
+hyperx
+main-loop
: https://github.com/substack/training/blob/master/web-dev-whirlwind/example/dom/hyperx-vdom/main.js - Small single page React app hosted on Github Pages: https://github.com/rafrex/spa-github-pages
- Choo + Socket.io simple chat app: https://github.com/notenoughneon/nekocafe
This file contains hidden or 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
var yo = require('yo-yo') | |
var globalState = {name: 'Artur', color: 'green'} | |
var el = render(globalState) | |
document.body.appendChild(el) | |
function render (state) { | |
return yo` | |
<div> | |
<h1>My name is ${state.name}</h1> |
This file contains hidden or 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
// Components + actions with Morphdom | |
var morphdom = require('morphdom') | |
var globalState = {name: 'Artur', color: 'green'} | |
var el = document.createElement('div') | |
el.innerHTML = render(globalState) | |
document.body.appendChild(el) |
This file contains hidden or 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
javascript:(function(){document.getElementsByTagName("html")[0].style.cssText = "filter: brightness(0.4); -webkit-filter: brightness(0.4); -moz-filter: brightness(0.4); -webkit-transform: translateZ(0);";})(); |