Skip to content

Instantly share code, notes, and snippets.

Andrew Lenards lenards

Block or report user

Report or block lenards

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 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
View Main.elm
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 Apr 20, 2019
If you place `Example.elm` under a "tests" directory, then `npm run test` should correctly execute `elm-test`
View Example.elm
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
View checkbox.css
/* 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;
View checkbox.css
/* 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%;
View checkbox.css
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;
}
View checkbox.css
input[type='checkbox'].check-custom {
top: 0;
left: 0;
width: 0;
height: 0;
opacity: 0;
filter: alpha(opacity=0);
position: absolute;
visibility: hidden;
}
View toggle-switch.css
/* 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;
View radio.css
/* Styles for hiding the native radio button */
input[type='radio'].check-custom {
top: 0;
left: 0;
width: 0;
height: 0;
opacity: 0;
filter: alpha(opacity=0);
position: absolute;
visibility: hidden;
@lenards
lenards / elm-0-19-elm-install-attempt
Last active Mar 20, 2019
This is the output from `elm.cmd install` as of elm 0.19 (0.19-bugfix6). The `package` command is no longer available, and `elm install :package-name` is only used when you are installing to the Elm module manifest, aka `elm.json`. See the note about how the command doesn't use the same approach as `npm install`.
View elm-0-19-elm-install-attempt
> ..\node_modules\.bin\elm.cmd install
-- INSTALL WHAT? ---------------------------------------------------------------
I am expecting commands like:
elm install elm/http
elm install elm/json
elm install elm/random
You can’t perform that action at this time.