Testing Timer-based Logic in Elixir with Klotho Library
We introduce an approach to testing time- and timer- based logic in Elixir with an unburdensome variant of dependency injection https://dev.to/savonarola/testing-timer-based-logic-in-elixir-with-klotho-library-2c90
Implementing an NTP server in Elixir
In this post we go thru a simple Network Time Protocol server implementation in Elixir. While the end product is not production ready we learn a lot about UDP, sniffing traffic, GenServers, bitstrings, sigils, and other cool tricks.
What's new in Livebook 0.10 - Introducing Multi-Session Livebook Apps
Livebook 0.10 was released! 🎉
The main new feature is Multi-Session Livebook Apps. You can think of them as something similar to scripts, but instead of running in a terminal, they are interactive web applications accessed through the browser.
The other new features are:
- Presentation View
- Initial Erlang Support
- Live Doctests
- Dataframe File Export
Announcement blog post: https://news.livebook.dev/whats-new-in-livebook-0.10—introducing-multi-session-livebook-apps-3Dbpss
Full changelog: https://github.com/livebook-dev/livebook/blob/v0.10/CHANGELOG.md
Adjustments of Phoenix application configuration
Rearrange PhoenixĘĽ config files to improve their developer experience!
https://bitcrowd.dev/two-small-adjustments-of-phoenix-application-configuration
Elixir Fortaleza Conf 2023
An event organized by the Elixir community. Dates: September 21st and 22st, 2023 Location: Fortaleza, Ceará, Brazil. Stay tuned for more information at https://elixiremfoco.com/elixirfortalezaen
How to run a function N times
Ever want to do something N times?
If you come from the Ruby on Rails world (like I did), you might be looking for something like 5.times { do_something }.
This is one way I like to do this:
-
Create a stream with the function you want to run repeatedly with
Stream.repeatedly/1. -
Then, when you want to run that
Ntimes, youEnum.take(N)!
Check it out! 👇
https://www.elixirstreams.com/tips/run-elixir-function-n-times
A small language (Ovo2) in Elixir : a graphical stateful environment
My experiment of a small language hosted in elixir finds closure with humor, after becoming an interactive stateful system with weird features and a graphical liveview interface. The post features a recreation of “99 bottles of beer” in an ovo-idiomatic way.
Introducing typeid_elixir
An Elixir implementation of TypeIDs: type-safe, K-sortable, and globally unique identifiers inspired by Stripe IDs
typeid_elixir | hex.pm sloanelybutsurely/typeid-elixir hexdocs
Thinking Elixir 159: Langchain with Elixir and Safe Ecto Migrations
Episode 159 of Thinking Elixir. Mark and David share what’s caught their interests and focus. Langchain is a popular framework in JS and Python communities for building services that knit together different services enabling people to quickly build impressive demos. Mark talks about the parts of Langchain that interest him and how he’s been building ways for Elixir apps to play in that space too. We also catch up with David’s job change, moving, and talk about his ideas around using Oban for managing data migrations in a new way.
Comparing Datetimes and Dates in Elixir
Elixir 1.15 introduced new DateTime and Date functions to compare dates.
Let’s cover the new functions, what already exists, and what to avoid at all costs!
-
New ✨:
DateTime.before?/2,DateTime.after?/2(and theirDatecounterparts) are new (since Elixir 1.15) and allow for strict comparison of datetimes (and dates), -
We’ve had
DateTime.compare/2for a while, and it returns:gt,:lt, or:eq. The nice thing aboutcompare/2is that it has equality. -
Never use
<,>,==to compare dates or datetimes! They perform structural comparisons. They don’t understand semantics.
Check out a short video of me walking through those! 👇 https://www.elixirstreams.com/tips/comparing-elixir-datetimes-and-dates
IntelliJ Elixir v15.1.0
Changelog
v15.1.0
Enhancements
- Add “Homebrew on Linux” SDK locations.
Bug Fixes
-
Replace uses of
Cell.horizontalAlign(HorizontalAlign)The API is scheduled for removal and is replaced byCall.align(AlignX.FILL). -
Ignore
group:for docs. - Don’t resolve built-in types against the index if index is updating.
-
findModuleForPsiElementinmostSpecificSdkin read action. -
Skip finding
mix.exsfor OTP apps if it can’t be read. -
Include
mix newstderr inIOExceptionfor better triage. - Highlight binary numbers and module attributes as usual in types.
-
Use
org.apache.commons.lang.SystemUtilsinstead oforg.codehaus.plexus.interpolation.os.Osto detect if on Windows for Test marker file URL. -
Call
FileIndex.getContentRootForFileinReadActionwhen getting working directory formix format. -
Don’t include
nulltarget usage types when finding usage type across all targets. - Skip bare Aliases when resolving Types.
-
Exclude
.elixir_lsdirectory when configuring newProjects. If the.elixir_lsdirectory is included the.beamit produces can interfere with normalStubIndex. - Check if Internal Erlang SDK home path exists for SDK for New Project.
-
Stop
prependingQualifiersat EEx tags.
How To Add Magic Link Login to phx.gen.auth
How to safely, simply, and securely add magic link login to your Phoenix app! phx.gen.auth provides the tools to make it quick and easy
Prefer LiveView's assert_redirect over assert_redirected
Someone in my Testing LiveView course recently asked,
When would you use
assert_redirectedinstead ofassert_redirect?
Just by looking at the helpers, you might think we want to use assert_redirected. But I always prefer using assert_redirect.
Here’s why 👇
https://www.germanvelasco.com/blog/prefer-assert-redirect-over-assert-redirected
New Elixir book: Build Your Own Web Framework in Elixir!
- Amazon Discount Code: 15ELIXIR (valid until July 31)
- Link: https://packt.link/sEaa3
Quick snippet from the “Preface”:
The goal is to demystify the aforementioned Phoenix magic by breaking it down into components and designing/building them from the ground up, all while testing their expected behaviors.
Wrote a Mix task that turns any Phoenix Site into a static site
https://github.com/lubien/single-file-phoenix-static/blob/main/lib/mix/tasks/generate_static.ex
Copy and past under lib/mix/tasks/generate_static.ex
Just released part (9/?) of my guide to LiveView for beginners.
https://dev.to/lubien/where-are-all-these-points-coming-from-758
Topics: creating models and contexts from scratch, starting with Ecto query, first glance at IEx.
Elixir's optional syntax
I always knew that Elixir had some optional syntax, but I didn’t realize how prevalent it was!
José Valim shared a new guide on Elixir’s optional syntax. And I thought it was really cool!
So, I created a short video to share an example. Hope you like it!
đź‘€ https://www.elixirstreams.com/tips/elixir-optional-syntax
Timezones with TzWorld
In episode 166 we’ll build an application to fetch timezones from latitude/longitude coordinates using TzWorld.
From idea to app: The ultimate guide to digital product development
🚀 Ever wondered what it takes to transform your idea into a fully functioning digital product? 📱💡 We’re thrilled to share our latest article “From Idea to App: The Ultimate Guide to Digital Product Development.”
This comprehensive guide takes you through each stage of the product development process. Whether you’re a seasoned developer or a bright-eyed entrepreneur, you should take a look. ✨ https://curiosum.com/blog/from-idea-to-app-the-ultimate-guide-to-digital-product-development
#DigitalProductDevelopment #AppDevelopment #TechGuide #Entrepreneurship
