Skip to content

Instantly share code, notes, and snippets.

// Fix for `cmd-r` when the cursor is on or in-between
// `<span style="display: inline-block" />` and a text
// node. This behavior depends on `traverseDOM`’s
// `findNode` resolving to the sibling text node.
const [isCmdArrowR, newAnchorNode] = detectIsCmdArrowR(e, props.state)
if (isCmdArrowR) {
e.preventDefault()
console.log("test")
const selection = document.getSelection()
const range = document.createRange()
import React from "react"
import PropTypes from "prop-types"
import useMethods from "use-methods"
import { Title } from "./Title"
// `isBreakNode` checks whether a node is `<br />` OR
// `<span><br /></span>`.
function isBreakNode(node) {
function utility(value) {
// ..
return value
}
const methods = (state) => {
a() {
// ..
},
b(value) {
@zaydek-old
zaydek-old / experimental-reset.css
Last active August 22, 2019 00:44
An experimental CSS reset that resets all styles to the equivalent of none, adds antialiasing and text-size-adjust for mobile browsers, and consistent box-sizing and a fix for contenteditable elements.
html { -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; text-size-adjust: 100%; }
* { all: unset; }
head, style, script { display: none; }
html { box-sizing: border-box; }
*, *:before, *:after { box-sizing: inherit; }
[contenteditable="true"] { -webkit-user-modify: read-write; }
// See github.com/google/closure-library/blob/master/closure/goog/color/color.js#L164
// for reference.
function hexToRgb(hexColor) {
// hexColor = goog.color.normalizeHex(hexColor);
var rgb = parseInt(hexColor.substr(1), 16);
var r = rgb >> 16;
var g = (rgb >> 8) & 255;
var b = rgb & 255;
return [r, g, b];
.debug h1,
.debug h2,
.debug p,
.debug blockquote {
margin-bottom: -1px !important;
background-image:
linear-gradient(
#B3E5FCFF 0.5px,
#B3E5FC00 0.5px,
#B3E5FC00 calc(var(--lh) * 0.5em - 0.25px),
@zaydek-old
zaydek-old / inter.js
Last active November 7, 2019 19:25
Inter dynametrics (use em)
function InterDynamicTracking(fontSize) {
var a = -0.0223, b = 0.185, c = -0.1745;
// tracking = a + b * e ^ (c * fontSize)
return a + b * Math.pow(Math.E, c * fontSize)
}
// See rsms.me/inter/dynmetrics for reference.
const A = -0.0223 // Don’t change.
const B = 0.185 // Don’t change.
const C = -0.1745 // Don’t change.
@zaydek-old
zaydek-old / regex-whitespace.js
Last active August 20, 2019 07:53
Unicode regex set for horizontal and vertical characters. Live example here: https://regex101.com/r/1hvmqw/1.
// Whitespace regexes based on Perl.
//
// See `perldoc perlrecharclass` for reference.
const reH = /[\u{0009}|\u{0020}|\u{00a0}|\u{1680}|\u{180e}|\u{2000}|\u{2001}|\u{2002}|\u{2003}|\u{2004}|\u{2005}|\u{2006}|\u{2007}|\u{2008}|\u{2009}|\u{200a}|\u{202f}|\u{205f}|\u{3000}]/gu
const reV = /[\u{000a}|\u{000b}|\u{000c}|\u{000d}|\u{0085}|\u{2028}|\u{2029}]/gu
const reHV = /[\u{0009}|\u{0020}|\u{00a0}|\u{1680}|\u{180e}|\u{2000}|\u{2001}|\u{2002}|\u{2003}|\u{2004}|\u{2005}|\u{2006}|\u{2007}|\u{2008}|\u{2009}|\u{200a}|\u{202f}|\u{205f}|\u{3000}|\u{000a}|\u{000b}|\u{000c}|\u{000d}|\u{0085}|\u{2028}|\u{2029}]/gu
// H: Horizontal e.g. `\h` in Perl.
// V: Vertical e.g. `\v` in Perl.
// HV: Horizontal and vertical e.g. `\h\v` in Perl.

here's an example $\forall x \in X, \quad \exists y \leq \epsilon$ ha

$$SE = \frac{\sigma}{\sqrt{n}}$$