Skip to content

Instantly share code, notes, and snippets.

View lenards's full-sized avatar

Andrew Lenards lenards

  • Tucson, AZ
View GitHub Profile
@lenards
lenards / elm-maybe-map-compose.md
Created July 23, 2022 18:31 — forked from JoelQ/elm-maybe-map-compose.md
Refactoring a pipeline of Maybe.map functions in Elm

Refactoring maybe code in Elm

Given this ugly series of cases:

optionalFormattedFriendAddress : Maybe Friend -> Maybe String
optionalFormattedFriendAddress maybeFriend =
  let
    maybeAddress = case maybeFriend of
      Just friend -> Just friend.address
@lenards
lenards / localdb-and-azure-storage-emulator.md
Last active July 24, 2020 20:35
Making Azure Storage Emulator Happy (Maybe) ... I hate to add the uncertainty there, but I wrote this up before I had full confirmation of the system working locally and I ended up ripping out all of `sql-server-2017` and getting `sql-server-2019` in place ...

Installing (localdb) on Windows 10

Why? "Sql Local", aka LocalDB is used by the Azure Storage Emulator to mimic the storage interfaces for Azure.

For some reason, installing Sql Server 2017 Developer edition does not offer in "Feature Selection" the ability to include (or add) SqlLocalDB (e.g. LocalDB, or (localdb)).

What to do?

Get the Installer & Install

@lenards
lenards / ID.elm
Created November 21, 2019 22:24 — forked from Herteby/ID.elm
module ID exposing (ID(..), decodeFromString, decoder, encode, encodeAsString, fromInt, toInt, toString)
import Json.Decode as Decode exposing (Decoder)
import Json.Encode as Encode exposing (Value)
{-| This type ensures you get a type error if you for example accidentally pass a UserId in place of a CompanyId
-}
type ID phantom
= ID Int
module Main exposing (main)
import Browser
import Html exposing (Html, button, div, option, select, text)
import Html.Attributes exposing (selected, value)
import Html.Events exposing (onClick, onInput)
type alias Model =
{ selected : Maybe OptionX }
@lenards
lenards / Example.elm
Created April 20, 2019 04:00
If you place `Example.elm` under a "tests" directory, then `npm run test` should correctly execute `elm-test`
module Example exposing (Event, decoderSuite, eventDecoder)
import Expect exposing (Expectation)
import Json.Decode as Json exposing (Decoder)
import Json.Decode.Pipeline exposing (optional, required)
import Test exposing (..)
type alias Event =
{ date : String
/* Styles for hiding the native checkbox */
input[type='checkbox'].check-custom {
top: 0;
left: 0;
width: 0;
height: 0;
opacity: 0;
filter: alpha(opacity=0);
position: absolute;
visibility: hidden;
/* Styles for the hover state of the custom checkbox */
input[type='checkbox'].check-custom:hover ~ .check-toggle {
border-color: #4a4a4a;
}
/* Styles for the checked state of the custom checkbox */
input[type='checkbox'].check-custom:checked ~ .check-toggle {
border-color: #1785ff;
background: #1785ff url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMyIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48cG9seWxpbmUgcG9pbnRzPSIyMCA2IDkgMTcgNCAxMiI+PC9wb2x5bGluZT48L3N2Zz4=) center no-repeat;
background-size: 75%;
input[type='checkbox'].check-custom ~ .check-toggle {
width: 1rem;
height: 1rem;
position: relative;
display: inline-block;
vertical-align: middle;
border: 2px solid #969696;
border-radius: 50%;
cursor: pointer;
}
input[type='checkbox'].check-custom {
top: 0;
left: 0;
width: 0;
height: 0;
opacity: 0;
filter: alpha(opacity=0);
position: absolute;
visibility: hidden;
}
/* Styles for hiding the native checkbox */
input[type='checkbox'].check-custom {
top: 0;
left: 0;
width: 0;
height: 0;
opacity: 0;
filter: alpha(opacity=0);
position: absolute;
visibility: hidden;