Skip to content

Instantly share code, notes, and snippets.

@mastercactapus
mastercactapus / webpack.config.js
Created February 24, 2016 03:12
webpack 2.x strict mode (with harmony imports)
"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)=>{
@MrOrz
MrOrz / README.md
Last active July 22, 2018 15:36
Cross-device BrowserSync with webpack demo
@branneman
branneman / better-nodejs-require-paths.md
Last active June 29, 2024 16:00
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

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.

Possible solutions

@astockwell
astockwell / _README.md
Last active December 30, 2023 22:39
PHP Serialization Fix. For use after a find/replace/sed on MySQL dump, to repair String lengths in serialized PHP objects. Optimized and refactored for memory-safe production use in Python (~7s for 250MB dump, ~400K replacements). Written also in Perl (~7s for 250MB), Ruby (~8s for 250MB) and Go (~20s for 250MB) for benchmark comparison. Python …
@DefiantBidet
DefiantBidet / gist:5293463
Created April 2, 2013 16:09
this is sample code to attempt to launch native applications from mobile browsers with a fallback to the html page if the native application is not installed on the users device. NOTE: this code sample is not DRY - and can be optimized. This is an amalgamation of several SO postings on the subject matter.
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
@liamcurry
liamcurry / html5video.sh
Created May 14, 2012 20:24 — forked from markupboy/html5video.sh
automated conversion of a file to all three html5 compatible video formats - h.264, ogg, and webm
#!/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`
@pfig
pfig / mkfavicon.sh
Created February 12, 2012 12:01
Make a multi-resolution favicon.ico from a source image, using ImageMagick
#!/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