Skip to content

Instantly share code, notes, and snippets.

$\forall x \in X, \quad \exists y \leq \epsilon$

function lex(value) {
const lexer = new Lexer(value)
let ch = ""
while ((ch = lexer.next())) {
let token = 0
switch (true) {
// comment
case ch == "/" && (lexer.peek() == "/" || lexer.peek() == "*"):
ch = lexer.next()
import React from "react"
// import PropTypes from "prop-types"
// import useMethods from "use-methods"
import * as traverseDOM from "./traverseDOM"
import { Title } from "./Title"
import { useForceUpdate } from "./useForceUpdate"
function ContentEditable(props) {
const ref = React.useRef(null)
const methods = (state: State) => ({
clearAll() {
return initialState
},
focus() {
state.focus = true
},
blur() {
state.focus = false
},
import React, { useEffect, useRef } from "react"
import useMethods from "use-methods"
const setLocalStorage = (key: string, value: Object) => {
const json = JSON.stringify(value)
localStorage.setItem(key, json)
}
const getLocalStorage = (key: string) => {
const json = localStorage.getItem(key)
import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react"
import PropTypes from "prop-types"
import useMethods from "use-methods"
import { findNode, findPos, readRoot } from "./traverseDOM"
import { Title } from "./Title"
const contentEditable = {
contentEditable: true,
suppressContentEditableWarning: true,
import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react"
import PropTypes from "prop-types"
import useMethods from "use-methods"
import { findNode, findPos, readRoot } from "./traverseDOM"
import { Title } from "./Title"
const contentEditable = {
contentEditable: true,
suppressContentEditableWarning: true,
const Fragment = props => (
<>
{["hello", "world"].map((item, index) => (
<p key={index}>
{!item ? <br /> : item}
</p>
))}
</>
)
return (
let Fragment = <React.Fragment />
for (const item of ["hello,", "world!"]) {
let El = (
<p>
{!item ? <br /> : item}
</p>
)
Fragment = (
<Fragment>
<El />
// parse("hello,\nworld!") ->
//
// <div>
// <p>
// hello,
// </p>
// <p>
// world!
// </p>
// </div>