Skip to content

Instantly share code, notes, and snippets.

@laggingreflex
laggingreflex / 0_reuse_code.js
Last active August 29, 2015 14:11
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@laggingreflex
laggingreflex / node wp redirect
Created June 12, 2015 12:39
Node forward path request to another server
// Node forward path request to another server
// http://stackoverflow.com/questions/30800829/node-forward-path-request-to-another-server
var request = require('request');
request = request.defaults({jar: true });
app.all('/blog*', function(req, res, next) {
console.debug('===============');
var jar = request.jar();
var cookie = request.cookie(serializeCookie(req.session.cookies));
@laggingreflex
laggingreflex / Error: write after end
Created June 13, 2015 05:45
connect-restreamer issue: Error: write after end
// https://github.com/dominictarr/connect-restreamer/issues/8
var express = require('express');
var app = module.exports = express();
var connectRestreamer = require('connect-restreamer');
var bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({
extended: true
var webpack = require('webpack');
var entryPath = Path.join(__dirname, 'lib/client');
var ngAnnotatePlugin = require('ng-annotate-webpack-plugin');
module.exports = {
cache: true,
devtool: 'source-map',
entry: Path.join(entryPath, 'webpack-entry.js'),
output: {
path: entryPath,
@laggingreflex
laggingreflex / LSOA_2011_BFC_Barking_and_Dagenham.zip
Last active June 3, 2016 12:13
LSOA_2011_BFC_Barking_and_Dagenham.kml
@laggingreflex
laggingreflex / Readme.md
Created July 30, 2016 23:44
UglifyJsPlugin is preventing generation of sourcemaps in Webpack 2

Install & run:

npm i webpack@2.1.0-beta.20
./node_modules/.bin/webpack

Output with UglifyJsPlugin

           Asset     Size  Chunks             Chunk Names
    index.min.js  2.59 kB       0  [emitted]  main
@laggingreflex
laggingreflex / Readme.md
Created August 27, 2016 01:34
[Question] How to install ST3 on WSL? It gives this error

I tried installing

sudo add-apt-repository ppa:webupd8team/sublime-text-3
sudo apt-get update
sudo apt-get install sublime-text-installer

but it gives error (full error below)

... (skipping lines that were ok)

Setting up sublime-text-installer (3114-2webupd80) ...

@laggingreflex
laggingreflex / sort.js
Created November 16, 2016 14:17
Sort github comments by reactions
(() => {
const q = (e, s) => e.querySelector(s);
const qA = (e, s) => e.querySelectorAll(s);
const num = e => parseInt(e.nextSibling.wholeText.trim())
const d = document.querySelector('.js-discussion.js-socket-channel');
/* uncomment one of these to sort by */
const sortBy = '+1';
// const sortBy = '-1';
// const sortBy = 'smile';
@laggingreflex
laggingreflex / markdown-js.html
Last active March 23, 2017 22:41
webpack bundles - difference between markdown-js vs marked - size comparison
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Webpack Bundle Analyzer</title>
<!-- viewer.js -->
<script>
"use strict";
const __non_webpack_module__ = module;
const __non_webpack_filename__ = __filename;
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/