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
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
Sometimes you want to have a subdirectory on the master
branch be the root directory of a repository’s gh-pages
branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master
branch alongside the rest of your code.
For the sake of this example, let’s pretend the subfolder containing your site is named dist
.
Remove the dist
directory from the project’s .gitignore
file (it’s ignored by default by Yeoman).
var http = require("http"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs") | |
port = process.argv[2] || 8888; | |
http.createServer(function(request, response) { | |
var uri = url.parse(request.url).pathname | |
, filename = path.join(process.cwd(), uri); |
#!/bin/bash | |
# | |
# Display the realtime bandwidth usage for the specified interface. | |
# | |
# dsimmons@squiz.co.uk | |
# 2011-08-03 | |
# | |
# Number of seconds to average data over | |
avgsecs=3 |
/** | |
* A function to take a string written in dot notation style, and use it to | |
* find a nested object property inside of an object. | |
* | |
* Useful in a plugin or module that accepts a JSON array of objects, but | |
* you want to let the user specify where to find various bits of data | |
* inside of each custom object instead of forcing a standardized | |
* property list. | |
* | |
* @param String nested A dot notation style parameter reference (ie "urls.small") |
If you search npm
with query try await
you will find a big modules list (you can find it in the boottom).
What all this developers want is just more clear way to use try catch. All of them suggest to use:
const tryCatch = require('try-catch');
const [error, data] = tryCatch(JSON.parse, 'hello');
As seen here: http://blog.z3bra.org/2014/01/images-in-terminal.html
Install packages w3m and some terminal emulator which supports images (urxvt, terminator, termite).
var redis = require("redis") | |
, subscriber = redis.createClient() | |
, publisher = redis.createClient(); | |
subscriber.on("message", function(channel, message) { | |
console.log("Message '" + message + "' on channel '" + channel + "' arrived!") | |
}); | |
subscriber.subscribe("test"); |
// for more info about ReDoS, see: | |
// https://en.wikipedia.org/wiki/ReDoS | |
var r = /([a-z]+)+$/ | |
var s = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaa!' | |
console.log('Running regular expression... please wait') | |
console.time('benchmark') | |
r.test(s) |