Skip to content

Instantly share code, notes, and snippets.

View citypaul's full-sized avatar

Paul Hammond citypaul

View GitHub Profile
@LeeCheneler
LeeCheneler / error-boundary-example-app.tsx
Last active June 3, 2020 09:18
Reporting error boundary with fallback
import React from "react";
import { ErrorBoundary } from "./error-boundary";
export const App = () => {
return (
<React.StrictMode>
<ErrorBoundary report={console.error}>
<h1>Example</h1>
</ErrorBoundary>
</React.StrictMode>

Parens And Performance

Years ago, some smart folks that worked on JS engines realized that not all JS that's loaded into a page/app initially is needed right away. They implemented JIT to optimize this situation.

JIT means Just-In-Time, which means essentially that the engine can defer processing (parsing, compiling) certain parts of a JS program until a later time, for example when the function in question is actually needed. This deferral means the engine is freer to spend the important cycles right now on the code that's going to run right now. This is a really good thing for JS performance.

Some time later, some JS engine devs realized that they needed to get some hints from the code as to which functions would run right away, and which ones wouldn't. In technical speak, these hints are called heuristics.

So they realized that one very common pattern for knowing that a function was going to run right away is if the first character before the function keyword was a (, because that usually m

@dantailby
dantailby / Copy Git History - Repo to Subdir.md
Last active May 12, 2016 13:02
This Gist contains instructions of how to preserve Git history of an existing repository as you convert that repo into a subdirectory of a larger repo.

Preface

@mintuz gist contains instructions of how to preserve history of a subdirectory between repos, for example a template or lib within morph-renderer which you are transferring into morph-modules. However this script doesn't work for a whole repository, such as something already (incorrectly) versioned or a standalone lib.

Based off of article found here: http://www.nomachetejuggling.com/2011/09/12/moving-one-git-repo-into-another-as-subdirectory

Instructions

You have two repos here. morph-modules and my-module. We will be copying 'my-module' and preserving it's history into morph-modules/my-module.`

@staltz
staltz / introrx.md
Last active July 13, 2025 10:33
The introduction to Reactive Programming you've been missing
@ndarville
ndarville / business-models.md
Last active June 13, 2025 01:26
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@swanson
swanson / gist:4056578
Created November 11, 2012 22:44
functional-core-imperative-shell/hexagonal-arch notes