This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
partition : List (Result x a) -> ( List x, List a ) | |
partition results = | |
let | |
helper : List (Result x a) -> ( List x, List a ) -> ( List x, List a ) | |
helper list ( es, ss ) = | |
case list of | |
[] -> | |
( es, ss ) | |
x :: xs -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Phone exposing (phoneParser) | |
import Parser exposing ((|.), (|=), Parser, Step(..), andThen, chompWhile, end, getChompedString, loop, oneOf, problem, run, succeed, symbol) | |
-- French phone number validation | |
-- This code makes sure that the phone number has one of the following prefixes: 0033 | +33 | 0. | |
-- This is only used for validation purposes so the prefix is not retained. | |
-- source https://korban.net/posts/elm/2018-09-07-introduction-elm-parser/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension Int { | |
init?(hexString: String) { | |
let string = hexString.replacingOccurrences(of: "#", with: "") | |
self.init(string, radix: 16) | |
} | |
var rgb: (red: Int, green: Int, blue: Int) { | |
let red = self >> 16 & 0xff |