Skip to content

Instantly share code, notes, and snippets.

roine / NumberRange.ts
Last active Oct 11, 2021
Range of numbers
View NumberRange.ts
type NumberRange<Min extends number, Max extends number> = _Range<Max, _Range1<Min,[Min]>>;
type _Range1<Min extends number, Acc extends unknown[]> = Acc['length'] extends Min ? Acc : _Range1<Min, [Min, ...Acc]>
type _Range<Max extends number, Range extends unknown[]> = Range['length'] extends Max
? Range['length']
: Range['length'] | _Range<Max, [Max, ...Range]>;
type FiveTo7 = NumberRange<5,7>
// 5 | 6 | 7
type OneTo7 = NumberRange<1,7>
View Debug.Extra.elm
module Debug.Extra exposing (viewModel)
import Html exposing (Html, p, pre, text)
import Html.Attributes exposing (style)
quote =
roine / Sample.elm
Last active Sep 23, 2018
Efficient (but less readable) checking if Leap Year. sample:, source:
View Sample.elm
isLeapYear : Int -> Bool
isLeapYear year =
Bitwise.and year 3 == 0 && (not (modBy year 25 == 0) || Bitwise.and year 15 == 0)
roine /
Last active Apr 8, 2021
Bare minimum for Elm 0.19

From 0.19 Elm introduced 4 ways to boot an app:

  1. sandbox (no outside interaction)
  2. element (simple outside interaction - side effect, flags, subscriptions)
  3. document (same as above but with title tag control)
  4. application (whole SPA features)

Keybase proof

I hereby claim:

  • I am roine on github.
  • I am roine ( on keybase.
  • I have a public key ASDvAb8MA0QlE3KRNLrTECoLQHkKG0_g6V6zalgXio_UvAo

To claim this, I am signing this object:

View gist:e40afdd44d7fa421900b81a5917f001c
roine / Blocked by IE9
Created Nov 17, 2016
Non exhaustive list of features not supported by IE9
View Blocked by IE9
- Websocket
- Flexbox
roine / Confirm.elm
Last active Aug 22, 2016
confirm in ELM using Native
View Confirm.elm
module Confirm exposing (confirm)
import Native.Confirm
import Task exposing (Task)
confirm : String -> Task () ()
confirm str =
Native.Confirm.doConfirm str
roine /
Created Jun 6, 2016 — forked from pete-otaqui/
Bump a software project's VERSION, add the CHANGES, and tag with GIT
# works with a file called VERSION in the current directory,
# the contents of which should be a semantic version number
# such as "1.2.3"
# this script will display the current version, automatically
# suggest a "minor" version update, and ask for input to use
# the suggestion, or a newly entered value.