Tested under webpack-dev-server 1.7.0.
- Clone this gist
npm install
npm start
- Visit http://localhost:8080 (or http://192.168.x.x:8080) on multiple devices
- Edit entry.js and hit save
"use strict"; | |
var ConcatSource = require("webpack-sources").ConcatSource; | |
class StrictPlugin { | |
constructor(options){ | |
this.options = options; | |
} | |
apply(compiler) { | |
compiler.plugin("compilation", compilation=>{ | |
compilation.moduleTemplate.plugin("render", (moduleSource, module, chunk, dependencyTemplates)=>{ |
Tested under webpack-dev-server 1.7.0.
npm install
npm start
When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:
const Article = require('../../../../app/models/article');
Those suck for maintenance and they're ugly.
var clickedAt = +new Date(), | |
timeout, iframe, webURI, nativeURI; | |
// '+newDate()' is the equivalent of calling valueOf method | |
// of the Date Object. + is a unary operator. | |
// see: http://xkr.us/articles/javascript/unary-add/ | |
if (navigator.userAgent.match(/Android/)) { | |
// Jelly Bean with Chrome browser | |
if (navigator.userAgent.match(/Chrome/)) { | |
// Jelly Bean with Chrome browser |
#!/bin/sh | |
# Output file for HTML5 video | |
# requirements: ffmpeg .6+ | |
# usage: ./html5video.sh infile.mp4 640x360 | |
target_directory='converted' | |
file=`basename $1` | |
filename=${file%.*} | |
filepath=`dirname $1` |
#!/bin/bash | |
# from | |
# http://bergamini.org/computers/creating-favicon.ico-icon-files-with-imagemagick-convert.html | |
convert source-WxW.png -resize 256x256 -transparent white favicon-256.png | |
convert favicon-256.png -resize 16x16 favicon-16.png | |
convert favicon-256.png -resize 32x32 favicon-32.png | |
convert favicon-256.png -resize 64x64 favicon-64.png | |
convert favicon-256.png -resize 128x128 favicon-128.png |