Skip to content

Instantly share code, notes, and snippets.

@XVilka
XVilka / TrueColour.md
Last active April 27, 2025 10:17
True Colour (16 million colours) support in various terminal applications and terminals

THIS GIST WAS MOVED TO TERMSTANDARD/COLORS REPOSITORY.

PLEASE ASK YOUR QUESTIONS OR ADD ANY SUGGESTIONS AS A REPOSITORY ISSUES OR PULL REQUESTS INSTEAD!

(Chapters marked with * are already written. This gets reorganized constantly
and 10 or so written chapters that I'm on the fence about aren't listed.)
Programmer Epistemology
* Dispersed Cost vs. Reduced Cost
* Verificationist Fallacy
* Mistake Metastasis
The Overton Window
Epicycles All The Way Down
The Hyperspace Gates Were Just There
@justinwoo
justinwoo / ShouldComponentUpdateExample.js
Last active August 29, 2015 14:10
shouldComponentUpdate example with a mock PureRenderMixin implementation. jsbin: http://jsbin.com/cobiyi/1/edit?js,output
/*
The default behavior of React is actually not very fast.
This is especially the case when you have a list or table with lots of elements to represent data.
Most of the data may not be changing, but the portions that do will need to get data passed down
from the parent. But since the parent needs to render all the siblings of the changed element,
having React reuse render() results on the siblings that haven't changed is very useful.
Good React Components are functions of only their props and state, and in those cases you will
inevitably end up going through the same render() calls which are unnecessary and they provide the
@sebmarkbage
sebmarkbage / Enhance.js
Last active February 10, 2025 06:23
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {
// Have some complicated non-React widgets that manipulate DOM?
// Do they manage a list of DOM elements? Here's how to wrap it
// into a React component so you can "constantly rerender" it.
// A dumb non-react widget that manually manage some DOM node that
// represent a list of items
function NonReactWidget(node) {
this.node = node;
}
@unnamedd
unnamedd / MacEditorTextView.swift
Last active May 27, 2025 14:38
[SwiftUI] MacEditorTextView - A simple and small NSTextView wrapped by SwiftUI.
/**
* MacEditorTextView
* Copyright (c) Thiago Holanda 2020-2021
* https://bsky.app/profile/tholanda.com
*
* (the twitter account is now deleted, please, do not try to reach me there)
* https://twitter.com/tholanda
*
* MIT license
*/