Skip to content

Instantly share code, notes, and snippets.

View rupertlssmith's full-sized avatar

Rupert Smith rupertlssmith

  • The Sett Ltd.
  • Edinburgh, Scotland.
View GitHub Profile
@rupertlssmith
rupertlssmith / ModalGroup.elm
Created September 17, 2024 10:22
Modal groups and tests for them in Elm
module ModalGroup exposing (..)
{-| A ModalGroup is a collection of items, zero or one of which can be active at a time.
It is intended for modelling the behaviour of modal dialog boxes, where at most one dialog box can
be open at a time.
-}
import Dict exposing (Dict)
@rupertlssmith
rupertlssmith / elm-grammar.ebnf
Created January 30, 2024 08:11 — forked from charbelrami/elm-grammar.ebnf
Elm EBNF grammar
program = [ comment ], [ "port" ], "module", module_name, "exposing", "(", exposed_list, ")", { import_statement }, { declaration }, { comment };
module_name = identifier, { ".", identifier }, [ comment ];
exposed_list = identifier | "(", identifier, { ",", identifier }, ")", [ comment ] | "..";
import_statement = "import", module_name, [ import_alias ], [ "exposing", "(", exposed_list, ")" ], [ comment ];
import_alias = "as", identifier, [ comment ];
declaration = type_declaration
| type_alias_declaration
@rupertlssmith
rupertlssmith / xen-and-systemd
Created December 11, 2023 11:27 — forked from paleo9/xen-and-systemd
Integrating Xen 4.2 with Systemd.
Integrating Xen 4.2 AUR with Systemd.
=================================
I tested the AUR package with a fresh installation of Arch of x86_64. Only
packages 'base', 'base-devel'and the dependencies mentioned on the site
were installed.
* package build also requires dev86
* dev86 is in multilib, x86_64 users need to enable multilib in /etc/pacman.conf
* users need to add a new entry to their bootloader config file (mentioned)
class Resizeable extends HTMLElement {
constructor() {
super();
this.resizeCallback = this.resizeCallback.bind(this);
this._observer = new ResizeObserver(this.resizeCallback);
}
connectedCallback() {
this._observer.observe(this);
@rupertlssmith
rupertlssmith / Existential.elm
Created December 19, 2022 12:40
Type hiding in Elm by using continuations.
module Existential exposing (add, impl, init, map, wrap)
impl : t -> (raise -> rep -> t)
impl constructor =
\raise rep -> constructor
wrap : (raise -> rep -> t) -> (raise -> rep -> (t -> q)) -> (raise -> rep -> q)
wrap method pipeline raise rep =
@rupertlssmith
rupertlssmith / DGrammar.elm
Created December 6, 2022 14:41
DSL for Diagrammer Clone
module DGrammar exposing (..)
import BoundingBox2d exposing (BoundingBox2d)
import Color exposing (Color)
import Point2d exposing (Point2d)
import Quantity exposing (Unitless)
import Vector2d exposing (Vector2d)
type alias DGram =
@rupertlssmith
rupertlssmith / Camera2d.elm
Created November 9, 2022 10:05
Elm 2d Camera
module Camera2d exposing
( Camera2d
, zoomedAt
, origin
, moveTo, translateBy, translateByScreen
, adjustZoom, adjustZoomScreen
, pToScene, pToScreen, svgViewBox
)
{-| A Camera2d maps a 2d scene to a screen.
module Main exposing (main)
import Browser
import Html exposing (Html)
import Html.Events
import Json.Decode
import Json.Encode
type alias Flags =
module Sticky.Editor exposing
( Model, Msg, init, update, view
, Style(..), BlockStyle(..)
, toggleStyle, toggleBlockStyle
, ControlContext, getControlContext
, Selection(..)
, setSelection
)
{-|
@rupertlssmith
rupertlssmith / ElmPackageServer.md
Last active February 28, 2024 17:38
Elm Package Server

Eco - An Alternate Elm Package Server

Eco is an alternative package management system for Elm. The name can stand for "Elm Compiler Offline".

The idea is to have a more configurable package management system for Elm, that allows for sharing private packages.

The main use case for this is intended to be within organizations, where a software developer or team can publish a private package that applications, or other private packages, in that organization can consume. This will support transitive dependency resolution in the same way that public Elm packages do.

The main repository and source of truth will be the existing package.elm-lang.org site.