nix2intel
I just finished the first iteration of my first Elixir project. I’m still super new to all of this and would love feedback, pull requests, etc. The code is available here GitHub - osintowl/builtwith: Builtwith API wrapper written in Elixir · GitHub and the documentation is here on hex builtwith. I would love to know if I’m doing dumb things, if there are different ways I should approach the problems, etc. I love elixir so far but still trying to grok it as python has been my main programming language for years.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Aludel - LLM Evaluation Workbench
Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 18 to 9- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
sodapopcan
privis the canonical place to store external resources, ie, non-Elixir files. Stuff inassetsgets copied into it which is ignored by default if you usephx_new. You can also store such things inlibif you use the@external_resourcemodule attribute though that’s a bit more advanced!seeplusplus
I have
privcommitted in some of my Phoenix projects, because it contains non-machine generated code (e.g., migrations, javascript, etc).I am glad the comments were helpful. And I am glad you are enjoying the language and the community. I feel the same way. The community is one of the best I have seen.
nix2intel
thank you so much! these are definetly the problems I want to avoid, i’ll be refactoring based on these comments. Elixir seems like such a beautiful and amazing language and community.
nix2intel
this is good to know thank you, what about priv? i’m trying to find all those edge cases.
nix2intel
i’ll look into this in the future, I can already tell a major refactoring going to happen here with some of the above and as I get to know elixir better.
nix2intel
Pattern-matchings is blowing my mind, thank you! goodbye python, this is so much cooler!
kokolegorille
While I have been using HTTPoison for most of my HTTP clients, I am now switching to Req, it has some cool stuff baked in (retry…)
sodapopcan
Not to speak for @dimitarvp but Andrea L. has a good write-up from a year ago now:
Despite HTTPoinson not being listed in the mini table of contents, he talks about it near the end.
kokolegorille
BTW Req is inspired by requests, a Python HTTP client…
seeplusplus
Some other general feedback (not Elixir specific, hope that’s ok):
Improve names
make_requestcan feel obvious in the moment you are writing the code, but don’t truly communicate what they are doing. Instead, considerlookup_by_domain.Do one thing
get_methods are doing more than one thing, for example:You are getting the first
resultfrom a list ofresultsand getting theSubDomainfrom it. I know most likely the first result of the list is probably the correct one, otherwise you wouldn’t have built it this way. The issue though is that your library is making a choice that’s hidden from the user. Namely, which one of the results is “correct.” What if my lookup by domain had multiple results and I actually wanted the second one? Instead, make theseget_methods only work with aResult, not a list ofResults, e.g. change the above to:Now, you do force the library user to pick which result they want, and they could get an error when using the
get_methods, but your current library has the following behavior:The user now has a list of subdomains and a list of attributes, but they aren’t from the same result. This could be very bad for some APIs. This exact scenario may be impossible with the Builtwith API, but it could be possible with another API with a different data model and could have very bad consequences if you get this mixed up.
Micro optimization: Avoid double
EnumcallsThis is a small one and someone may correct me if I’m incorrect about this. In
get_subdomains:Each call to
Enumwill basically allocate a new list (which will increase memory usage). Instead you can use theStreamAPI:This will lead to a slight optimization to the memory footprint of your code. Note, Streams are lazy - the output of a
Streammethod is always aStream, so you will always need to end with anEnummethod to get the type you actually want at the end.