This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- livebook:{"persist_outputs":true} --> | |
# Distribute | |
## Section | |
A small toy to show how you might, given a stream, do a "fan out", processing different elements in separate streams. Powered by simple primitives like `Stream.resource` and `spawn_link`. | |
```elixir | |
defmodule Distribute do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function useOnRead({ | |
parentElRef, | |
onRead, | |
enabled = true, | |
}: { | |
parentElRef: React.RefObject<HTMLElement> | |
onRead: () => void | |
enabled: boolean | |
}) { | |
React.useEffect(() => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from "react"; | |
import { useMousePosition } from "~/hooks/useMousePosition"; | |
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */ | |
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) { | |
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {}; | |
const [mouseX, mouseY] = useMousePosition(); | |
const positions = { x, y, h, w, mouseX, mouseY }; | |
return ( | |
<div |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"========================== | |
" searching | |
"========================== | |
set incsearch | |
set ignorecase | |
set smartcase | |
set commentary | |
set easymotion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set ignorecase | |
set smartcase | |
set scrolloff=3 " 3 lines above/below cursor when scrolling | |
" Emulated Plugins | |
set surround | |
" set easymotion | |
set NERDTree | |
" Copy to system clipboard as well |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"========================== | |
" visuals | |
"========================== | |
set title | |
set titleold="Terminal" | |
set titlestring=%F | |
set guioptions=egmrti | |
set gcr=a:blinkon0 | |
set scrolloff=5 | |
set laststatus=2 |