This is a comprehensive reference guide for creating high-quality web animations. Use this as a knowledge base for implementing animations in web applications. All principles, timing values, and easing functions provided here are production-tested and ready to use.
| import "server-only"; | |
| import { parse } from "@babel/parser"; | |
| import traverse from "@babel/traverse"; | |
| import * as t from "@babel/types"; | |
| import { generate } from "@babel/generator"; | |
| const SNAPSHOT = "__snapshots"; | |
| export function parseAlgorithm(code: string) { | |
| const ast = parse(code); |
This post is meant as a long-overdue reply to u/PitifulTheme411's question on this topic. The length is unfortunate, but I wanted to be sure that I was explaining the algorithm in detail so that it could be reproduced.
This algorithm supports defining mixfix operators with different parsing behavior based on context: possible contexts include expressions, patterns, types, and top-level declarations. A total order of precedence is assumed, but is not required. This algorithm also does not correspond to any formalism that I am aware of, so it's going to be the only thing that can parse your files if you use it.
Declarations of syntax within the file being parsed are not supported: they're relatively easy to analyze and provide IDE support for (both the file with the definitions and the file b
| import { File, type FileHandle } from 'expo-file-system/next' | |
| interface FileInput { | |
| uri: string | |
| } | |
| export default class TusFileReader { | |
| async openFile({ uri }: FileInput) { | |
| const handle = new File(uri) | |
| if (!handle.exists || !handle.size) throw new Error(`File ${uri} not found`) |
| // useful links: | |
| // custom easing by Lochie (x.com/lochieaxon): https://www.easing.dev | |
| // motion-primitives by Ibelick (x.com/Ibelick): https://motion-primitives.com/docs | |
| // The Magic of Clip Path article by Emil Kowalski (x.com/emilkowalski_): https://emilkowal.ski/ui/the-magic-of-clip-path | |
| // we use same transition for every element to make it look consistent | |
| const transition: Transition = { | |
| duration: 2.5, | |
| // custom easing from https://www.easing.dev | |
| ease: [0.175, 0.885, 0.32, 1], |
| // .vscode/settings.json | |
| { | |
| "tailwindCSS.experimental.classRegex": [ | |
| ["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"], | |
| ["cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"], | |
| ["styled\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"] | |
| ], | |
| } |
| import { useSafeAreaInsets } from 'react-native-safe-area-context' | |
| import { useCallback, useLayoutEffect, useMemo, useReducer, useRef, useState } from 'react' | |
| import { ActivityIndicator, Keyboard, Platform, Text, View, TextInput, useWindowDimensions } from 'react-native' | |
| import Animated from 'react-native-reanimated' | |
| const SearchBar = () => { | |
| const inset = useSafeAreaInsets() | |
| const [isFocused, toggle] = useReducer((s) => !s, false) | |
| const ref = useRef<View>(null) | |
| const rect = useRef({ width: 0, height: 0, x: 0, y: 0 }) |
A couple of code samples to show how a named pipe can be used to extend Go's channel paradigm for use between different processes running on a system.
- interprocess1.go details a single byte channel.
- interprocess2.go details a channel that passes slices of bytes.
Note that opening a write channel will return two channels -