Skip to content

Instantly share code, notes, and snippets.

View joerichsen's full-sized avatar

Jørgen Orehøj Erichsen joerichsen

  • erichsen.net
  • Århus, Denmark
View GitHub Profile
@benvp
benvp / KeyBuffer.ts
Created November 16, 2022 12:56
LiveView Shortcuts
/**
* Allows for recording a sequence of keys pressed
* and matching against that sequence.
*
* Taken from the livebook repo and adapted a little bit.
*/
export class KeyBuffer {
private resetTimeout: number;
private buffer: string[] = [];
private resetTimeoutId: number | null = null;
@LostKobrakai
LostKobrakai / form_live.ex
Last active April 12, 2024 18:56
Phoenix LiveView form with nested embeds and add/delete buttons
defmodule NestedWeb.FormLive do
use NestedWeb, :live_view
require Logger
defmodule Form do
use Ecto.Schema
import Ecto.Changeset
embedded_schema do
field :name, :string