Skip to content

Instantly share code, notes, and snippets.

View jareware's full-sized avatar

Jarno Rantanen jareware

View GitHub Profile
@nolanlawson
nolanlawson / why_we_dropped_lerna_from_pouchdb.md
Last active December 13, 2023 10:56
Why we dropped Lerna from PouchDB

Why we dropped Lerna from PouchDB

We dropped Lerna from our monorepo architecture in PouchDB 6.0.0. I got a question about this from @reconbot, so I thought I'd explain our reasoning.

First off, I don't want this post to be read as "Lerna sucks, don't use Lerna." We started out using Lerna, but eventually outgrew it because we wrote our own custom thing. Lerna is still a great idea if you're getting started with monorepos (monorepi?).

Backstory:

import deepFreeze from "deep-freeze";
import isPlainObject from "lodash/fp/isPlainObject";
export function wrapSanityChecks(reducer) {
if (process.env.NODE_ENV === "production") return reducer;
return (state, action) => {
if (!isPlainObject(action)) {
const msg = `Bad action object of type ${typeof action}`;
@kpuputti
kpuputti / js.md
Last active February 24, 2016 12:53

Brief History of Frontend Tooling

A few years ago, when the Frontend developer tooling craze hadn't yet started, techniques for building and optimizing JavaScript applications varied. Many were using shell scripts (cat to concatenate files etc.), tools provided by the web framework (like Play Framework's templates), or some generic Java-based tools. There might have been some manual operations (especially around minifying for production builds), and most of the tooling was not JavaScript-based.

Then Frontend developers started to notice that it was really hard to reason about lots of files that each rely on some globals (making the inclusion order significant) and expose a "namespace" (global variable) for other files to use. Then came AMD (Asynchronous Module Definition), which enabled making modules that define their dependencies and that explicitly exposed their exports. AMD modules were used together with the require.js tool and the r.js optimizer. The A in AMD (asynchronous) was a clear design choi

@ohanhi
ohanhi / joy-of-composition.md
Last active February 3, 2021 18:14
The Joy of Composition - Why stateless rendering is pure bliss

This is a proposal for a lightning talk at the Reactive 2015 conference.

NOTE: If you like this, star ⭐ the Gist - the amount of stars decides whether it makes the cut!

The Joy of Composition

Why stateless rendering is pure bliss

React just got stateless components, meaning that they are in essence pure functions for rendering. Pure functions make it dead simple - even fun - to refactor your views

@lambdahands
lambdahands / cta.js
Created December 9, 2014 21:50
flow-type + immutable-js
/* @flow */
var T = require('immutable');
type Branch = T.List<string>
type TrainLine = T.Map<string, Branch>
type CTAMap = T.Map<string, TrainLine>
/*
* Representation of Chicago's train stops and branches
@addyosmani
addyosmani / package.json
Last active January 18, 2024 21:31
npm run-scripts boilerplate
{
"name": "my-app",
"version": "1.0.0",
"description": "My test app",
"main": "src/js/index.js",
"scripts": {
"jshint:dist": "jshint src/js/*.js",
"jshint": "npm run jshint:dist",
"jscs": "jscs src/*.js",
"browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js",
requirejs.config({
shim: {
backbone: {
deps: ['underscore', 'jquery'],
exports: 'Backbone'
},
underscore: {
exports: '_'
},
"Handlebars": {