Skip to content

Instantly share code, notes, and snippets.

View avh4's full-sized avatar

Aaron VonderHaar avh4

View GitHub Profile
@avh4
avh4 / string-conversions.hs
Created February 17, 2021 19:36 — forked from dino-/string-conversions.hs
A handy illustration of converting between String, Text and ByteString in Haskell
#! /usr/bin/env stack
-- stack --resolver lts-12.14 script
{-# LANGUAGE OverloadedStrings #-}
{-
This is a handy illustration of converting between five of the commonly-used
string types in Haskell (String, ByteString, lazy ByteString, Text and lazy
Text).
@avh4
avh4 / Duckling.elm
Created December 12, 2020 22:29
Infinite ducklings
module Duckling exposing (main)
{-| This demo loads a convex shape and a mesh from the same OBJ file.
- elm-physics is used for simulation
- elm-3d-scene is used for rendering
It is important to keep the convex shape as small as possible, because
this affects the simulation performance.
@avh4
avh4 / CountOpenSafariTabs.scpt
Created October 31, 2020 19:28 — forked from edenwaith/CountOpenSafariTabs.scpt
AppleScript: Count the number of open tabs in Safari
-- CountOpenSafariTabs.scpt
-- Author: Chad Armstrong
-- Date: 13 May 2016
-- Description: Count the number of open tabs in Safari
-- To run from CLI: osascript CountOpenSafariTabs.scpt
tell application "Safari"
--Variables
set winlist to every window
@avh4
avh4 / Wireframe.elm
Created April 25, 2020 03:29
elm-ui wireframe
module Main exposing (main)
import Element exposing (..)
import Element.Background as Background
import Element.Border as Border
import Element.Font as Font
main =
layout [] <|
@avh4
avh4 / main.hs
Last active December 21, 2019 19:10
Haskell type params subset
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeFamilyDependencies #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE Rank2Types #-}
data Never
@avh4
avh4 / main.hs
Last active October 23, 2019 19:43
Haskell AST types
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleInstances #-}
import Data.Functor.Identity (Identity(..))
import Html
import Html.Events
import Json.Decode
onClickPreventDefaultForLinkWithHref : msg -> Html.Attribute msg
onClickPreventDefaultForLinkWithHref msg =
let
isSpecialClick : Json.Decode.Decoder Bool
isSpecialClick =
Json.Decode.map2
#!/bin/bash
set -e
git fetch
CURRENT="$(git rev-parse --abbrev-ref HEAD)"
# find where the current branch branched from origin/master
REFERENCE="origin/master"
@avh4
avh4 / RichText.elm
Last active October 14, 2016 18:49 — forked from Janiczek/RichText.elm
-- the type aliases would be private
type RichText
= RichText (List Line)
type alias Line =
{ left : List (Attributes, String)
, center : List (Attributes, String)
, right : List (Attributes, String)