Skip to content

Instantly share code, notes, and snippets.

View newbreedofgeek's full-sized avatar
😖
web3 anyone?

Mark Paul newbreedofgeek

😖
web3 anyone?
View GitHub Profile
@johanneslumpe
johanneslumpe / gulpfile.js
Created October 14, 2015 13:57 — forked from cgmartin/gulpfile.js
Node ES6 istanbul, isparta, mocha-co gulpfile example
'use strict';
var gulp = require('gulp');
var del = require('del');
var mocha = require('gulp-mocha-co');
var istanbul = require('gulp-istanbul');
var isparta = require('isparta');
var coverageEnforcer = require('gulp-istanbul-enforcer');
var paths = {
server: {
@acdlite
acdlite / app.js
Last active January 20, 2023 08:23
Quick and dirty code splitting with React Router v4
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
@miguelmota
miguelmota / gzip.js
Created January 15, 2019 15:02
Node.js gzip compress and decompress example
const zlib = require('zlib')
const buf = Buffer.from('hello world', 'utf-8')
zlib.gzip(buf, (err, compressed) => {
if (err) {
console.error(err)
}
console.log(compressed) // <Buffer 1f 8b 08 00 00 00 00 00 00 13 cb 48 cd c9 c9 57 28 cf 2f ca 49 01 00 85 11 4a 0d 0b 00 00 00>