Skip to content

Instantly share code, notes, and snippets.

adauguet

Block or report user

Report or block adauguet

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
@adauguet
adauguet / FrenchPhoneNumber.elm
Last active Mar 6, 2019
French phone number validation
View FrenchPhoneNumber.elm
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/
View UIColor+Hex.swift
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
You can’t perform that action at this time.