Skip to content

Instantly share code, notes, and snippets.

var Log = require('./log');
function convertLogs(event) {
var LogEvent = {
event: event.data,
tags: event.tags
};
if (event.request) {
LogEvent.request = event.request;
'use strict';
var fs = require('fs');
var gm = require('gm');
var but = require('but');
var path = require('path');
var contra = require('contra');
var Imagemin = require('imagemin');
var pngquant = require('imagemin-pngquant');
var mozjpeg = require('imagemin-mozjpeg');
@mikeal
mikeal / gist:6084298
Last active December 20, 2015 06:18
Been rather busy....

Because I've been so busy lately I haven't really had a chance to talk about anything I've built or been using, but i've been publishing so many new modules it's worth going back over.

Real quick, Getable is a mobile/desktop ordering and fullfillment application for commercial construction. Think mobile amazon/ebay for large construction jobsites.

First off, everything is realtime, using engine.io with everything but long polling turned off. We tried leaving websockets on but there were some nasty bits that made the connection die and not come back on iPhone which we just couldn't debug in time so we turned it off.

Engine.io is a great module as it just provides a simple duplex stream-like (more on this later) interface that upgrades itself when available. This meant that in order to get some use out of it I had to write a few modules.

eiojson sends JSON messages rather than strings bidirectiona

@nolanlawson
nolanlawson / webpack.md
Last active March 30, 2017 17:00
PouchDB issues with supporting Webpack
@tappleby
tappleby / 0_usage.js
Last active April 5, 2018 12:50
Experimental middleware + reducer which tracks performance of all dispatched actions in https://github.com/gaearon/redux >= 1.0.0. Supports async actions which follow pattern outlined here https://github.com/gaearon/redux/issues/99#issuecomment-112212639
import { createStore } from 'redux';
import { performanceMiddleware, performanceReducer, performancePrintTable } from './redux/util/performance';
import thunkMiddleware from 'redux/lib/middleware/thunk';
import promiseMiddleware from './redux/middleware/promiseMiddleware';
import * as reducers from './reducers/index';
// Util functions.
function asyncAction(promise, request, success, failure) {
return { types: [request, success, failure], promise };
}
@mattdesl
mattdesl / about.md
Last active August 9, 2019 13:21
fast & optimized browserify builds

Small script for development + builds with browserify.

Uses loose-envify for faster inlining and cross-env to handle windows/unix shells.

Dev features:

  • fast rebuilds w/ watchify, LiveReload, syntax errors in DOM, etc.

Build features:

  • uglify, simple dead code elimination, optimized bundle.
@gaearon
gaearon / ReduxMicroBoilerplate.js
Last active March 26, 2020 00:35
Super minimal React + Redux app
import React, { Component } from 'react';
import { createStore, combineReducers, applyMiddleware, bindActionCreators } from 'redux';
import { provide, connect } from 'react-redux';
import thunk from 'redux-thunk';
const AVAILABLE_SUBREDDITS = ['apple', 'pics'];
// ------------
// reducers
// ------------
@koreno
koreno / README.md
Last active April 1, 2020 10:44
'rebaser' improves on 'git rebase -i' by adding information per commit regarding which files it touched.

Prebase

git-prebase improves on 'git rebase -i' by adding information per commit regarding which files it touched.

  • Each file gets an alpha-numeric identifier at a particular column, a list of which appears below the commit list. (The identifiers wrap around after the 62nd file)
  • Commits can be moved up and down safely (without conflicts) as long as their columns don't clash (they did not touch the same file).

Installation

Add the executable to your path and git will automatically expose it as

@gaearon
gaearon / combining.js
Created June 3, 2015 18:03
Combining Stateless Stores
// ------------
// counterStore.js
// ------------
import {
INCREMENT_COUNTER,
DECREMENT_COUNTER
} from '../constants/ActionTypes';
const initialState = { counter: 0 };
@xalakox
xalakox / couchdb csv list
Created June 30, 2012 23:28
CouchDB JSON to CSV view converter use ?include_docs=true&reduce=false
{
"csv":"function(head, req){
start({
'headers': {
'Content-Type': 'text/csv'
}
});
Array.prototype.unique = function() {
var a = this.concat();