dogweather
Dbg is a life-saver for text parsing
It’s turned into a killer feature for me. I write lots of parsing code, extracting info from laws and statutes. dbg’s ability to show intermediate values in a pipeline is amazing for helping me understand where my code went wrong.
E.g., here I’m trying to extract the Chapter range, 90 - 130 but I’ve got a bug.
range_string =
raw_string
|> String.split("-", parts: 3)
|> at(2)
|> trim()
|> String.split()
|> at(1)
|> String.split("(")
|> at(0)
|> dbg
[lib/crawlers/ors/parser.ex:52: Parser.extract_chapter_range/1]
raw_string #=> "Volume : 03 - Landlord-Tenant, Domestic Relations, Probate - Chapters 90-130 (36)"
|> String.split("-", parts: 3) #=> ["Volume : 03 ", " Landlord",
"Tenant, Domestic Relations, Probate - Chapters 90-130 (36)"]
|> at(2) #=> "Tenant, Domestic Relations, Probate - Chapters 90-130 (36)"
|> trim() #=> "Tenant, Domestic Relations, Probate - Chapters 90-130 (36)"
|> String.split() #=> ["Tenant,", "Domestic", "Relations,", "Probate", "-", "Chapters",
"90-130 (36)"]
|> at(1) #=> "Domestic"
|> String.split("(") #=> ["Domestic"]
|> at(0) #=> "Domestic"
Seeing this helped me quickly decide to just use a Regex.
Most Liked
kairos0ne
Theres also nimble parsec GitHub - dashbitco/nimble_parsec: A simple and fast library for text-based parser combinators · GitHub I found incredibly powerful
3
Popular in Discussions
Elixir Upgrading is so Simple in Ubuntu and It worked for me
Ubuntu 16.04
git clone https://github.com/elixir-lang/elixir.git
cd elixir...
New
After doing a port from a c++ library to my project in phoenix I’ve seen that I need a faster way to run this algorithm and I found this ...
New
Hello everyone :wave:
Today I am very excited to announce a project that I have been working on for almost 3 months now.
The project is...
New
I’ve been hearing much about the new formatter and it’s something I have been keen to try.
I find examples buy far the most illuminating...
New
Erlang :list.nth simple, but 1 - based
nth(1, [H|_]) -> H;
nth(N, [_|T]) when N > 1 ->
nth(N - 1, T).
Elixir Enum.at … coo...
New
Hi all,
I’ve seen a number of related threads in the past, but I’d still be very curious to hear an up-to-date opinion on this topic.
I...
New
Hello everyone!
A few days ago I’ve created a topic here about how people were creating CMSs with Elixir and Phoenix. I’ve been studying...
New
Hello,
I want to share a project I’ve been working on for a while:
https://github.com/almightycouch/gitgud
Background
Some time ago I ...
New
Looking at the stacks that existing large companies have used, WhatsApp internally uses Mnesia to store the messages, while Discord uses ...
New
Hi all
How can I compare haskell with elixir, included tools, webservices, ect.
Thanks
New
Other popular topics
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
In templates/appointment/index.html.eex:
<%= for appointment <- @appointments do %>
<tr>
<td><%= appoi...
New
I have VueJS GUIs with the project generated using Webpack.
I have Elixir modules that will need to be used by the VueJS GUIs.
I forese...
New
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including.
What is Phoenix LiveV...
New
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
New
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)?
Would
mix ecto.rollback -v 200809061...
New
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance










