Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| var express = require('express'); | |
| var router = express.Router(); | |
| var multipart = require('connect-multiparty'); | |
| var multipartMiddleware = multipart(); | |
| router.get('/', function(req, res) { | |
| res.render('index'); | |
| }); |
| // Credit to @steobrien from https://gist.github.com/rmehner/b9a41d9f659c9b1c3340#gistcomment-2940034 | |
| // for modern browsers, this works: | |
| const dbs = await window.indexedDB.databases() | |
| dbs.forEach(db => { window.indexedDB.deleteDatabase(db.name) }) | |
| // for older browsers, have a look at previous revisions of this gist. |
| /** | |
| * NOTE: Because Chrome doesn't elevate the permissions | |
| * of snippets, we can't push the image out to the browser | |
| * using canvas.toDataURL(), we have to add it to the page | |
| * and have the user right-click and save-as | |
| */ | |
| var css = function(el, styles){ | |
| for (var style in styles) { | |
| if(!styles.hasOwnProperty(style)) continue; | |
| el.style[style] = styles[style]; |
| #!/usr/bin/env bash | |
| # MIT © Sindre Sorhus - sindresorhus.com | |
| # git hook to run a command after `git pull` if a specified file was changed | |
| # Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`. | |
| changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
| check_run() { | |
| echo "$changed_files" | grep --quiet "$1" && eval "$2" |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| <!doctype html> | |
| <title>Site Maintenance</title> | |
| <style> | |
| body { text-align: center; padding: 150px; } | |
| h1 { font-size: 50px; } | |
| body { font: 20px Helvetica, sans-serif; color: #333; } | |
| article { display: block; text-align: left; width: 650px; margin: 0 auto; } | |
| a { color: #dc8100; text-decoration: none; } | |
| a:hover { color: #333; text-decoration: none; } | |
| </style> |
| var net = require('net') | |
| var sock = net.connect(1337) | |
| process.stdin.pipe(sock) | |
| sock.pipe(process.stdout) | |
| sock.on('connect', function () { | |
| process.stdin.resume(); | |
| process.stdin.setRawMode(true) |
| var http = require('http'); | |
| var url = require('url'); | |
| var proxy = http.createServer(function(req, res) { | |
| var request = url.parse(req.url); | |
| options = { | |
| host: request.hostname, | |
| port: request.port || 80, | |
| path: request.path, | |
| method: req.method, |