Skip to content

Instantly share code, notes, and snippets.

View alvinncx's full-sized avatar
👋
Happy to chat!

Alvin Ng alvinncx

👋
Happy to chat!
View GitHub Profile
@alvinncx
alvinncx / parser.ex
Last active April 20, 2019 06:37
Parsing DBS transactions
defmodule Parser do
@moduledoc """
Sample parser for data from DBS. It is annoying that there isn't a csv from DBS bank
Sample data:
18 Mar 2019 GRAB *16236905-9-139 S$23.00
18 Mar 2019 GRAB *2B3B63422351042EE S$10.00
18 Mar 2019 GRAB *1391705-9-138 S$15.00
19 Mar 2019 2C2P - ZARA.COM SG S$29.90 cr
@alvinncx
alvinncx / regex.ex
Created April 6, 2019 07:54
Username and email regex
@mail_regex ~r/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/
@username_regex ~r/^(?=.{8,20}$)(?![_.])(?!.*[_.]{2})[a-zA-Z0-9._]+(?<![_.])$/
@alvinncx
alvinncx / config.exs
Last active February 4, 2021 12:30
Getting Phoenix.PubSub & Phoenix.LiveView to work together
# Configures the endpoint
config :example, Example.Endpoint,
...
pubsub: [name: Example.PubSub, adapter: Phoenix.PubSub.PG2],
...