Building a Rasberry Pi weather station with Elixir/Nerves - Part 3
I explain how to read data from the wind speed sensor via the MCP3008 analog to digital chip.
https://www.frankkumro.com/post/rasberry-pie-elixir-nerves-weather-station-part3/
@elixirlang @nervesproject #myelixirstatus #RasberryPi
{:ok, {📍, LibLatLon}} and binary pattern matching for the rescue
Blogged on how I pattern matched binaries to parse geo location instead of using Regex
in handy geo coordinates library LibLatLon
⇒ http://rocket-science.ru/hacking/2018/01/12/parse-cumbersome-data
Mock current time in Elixir
Coming from the Ruby/Rails world I was searching for a way to mock the current time in my Elixir test suite, something like Timecop for Elixir. I didn’t find anything that suited my needs so I decided to give it a go by myself.
Bitcoin's Base58Check in Pure Elixir
Check out how we can implement Bitcoin’s Base58Check encoding algorithm, an important piece in the process of converting a private key into a public address, in pure Elixir!
{:ok, 📍} aka LibLatLon library to handle geo coordinates
The library provides both handling the coordinates in any imaginable format and querying geodata providers for both direct and reverse geo lookup.
iex|1 â–¶ LibLatLon.lookup("test/inputs/1.jpg")
iex|2 â–¶ LibLatLon.lookup({41.376223, 2.1483528})
iex|3 â–¶ LibLatLon.lookup(lat: 41.376223, lon: 2.1483528)
iex|4 â–¶ LibLatLon.lookup("Carrer de Tarragona, Hostafrancs, [...]")
#⇒ %LibLatLon.Info{
# address: "Carrer de Tarragona, Hostafrancs, [...], 08023, España",
# ...
Building a Rasberry Pi weather station with Elixir/Nerves - Part 2
The weather station project powered by Elixir/Nerves receives it’s second update.
https://www.frankkumro.com/post/rasberry-pie-elixir-nerves-weather-station-part2/
AC9: Using Elixir macros to simplify our views
Building the http://Alchemist.Camp website, Part 9. Let’s write some macros and make a lean view layer!
We split our “kitchen sink controller” into reasonable framework abstractions for controllers and views and then take advantage of this work to create an episode controller for Alchemist.Camp.
the difference between the for comprehension and Enum.each - goodcode
the difference between the for comprehension and Enum.each https://goodcode.in/elixir/5/the-difference-between-the-for-comprehension-and-enum-each
Benchmarking ++ vs | for list concatenation
Ever wondered just how much slower ++
is versus the cons operator (|
) for adding together lists? It’s probably worse than you thought!
https://github.com/devonestes/fast-elixir#combining-lists-with–vs–code
A Tweak to Phoenix Contexts
I show off what approach I’ve been using in my side project that is a little different than the bounded context approach.
https://blog.oestrich.org/2018/01/tweak-to-phoenix-contexts/
Empex Los Angeles
A one-day conference for curious elixir programmers in Los Angeles, CA - Saturday, February 10, 2018 - http://empex.co/la.html
Simple encrypted auth tokens for Phoenix
Any web application with a login system needs a mechanism to track whether your users are actually logged in.
This post will explore the implementation of our very own authentication token library, which you can find here on Github: https://github.com/Brainsware/authtoken
We will go over fleshing out an API for working directly with auth tokens, talk about expiring and refreshing tokens. At the end we’ll cover a router plug to use in a Phoenix project:
https://sealas.at/blog/2018-01/encrypted-auth-tokens-for-phoenix-auth-part-2/
Automate pattern matching for structs
Blogged an example of how one might use macros to automate pattern matching on different structs.
http://rocket-science.ru/hacking/2018/01/08/automate-struct-pattern-matching
Solution to Challenge 12: Making bitmaps with color palettes
We’ll dive into working with Elixir bitstrings and upgrade the bitmap image generator from last lesson.
By the end of the video we’ll be able to create color palettes and generate monochrome or 16-color images along with 24-bit color images.
IntelliJ Elixir 7.2.1
-
Use
documentionRootType
to indirectly get the documentationOrderRootType
in the Erlang SDK Type, so that it works in Small IDEs that have more thanCLASSES
andSOURCES
root types installed. -
The
credo
annotator is disabled by default as numerous users find runningmix credo
in the background has a negative impact on their system performance. If you like to try enabling the annotation, you can turn it on using the configuration.- Preferences > Editor > Inspections > Elixir
- Check “Credo”
- Click OK to save and close Preferences If you notice a degradation the in the responsiveness of the editor, it is recommended you disable the annotator again.
- Preferences > Editor > Inspections > Elixir
- Uncheck “Credo”
- Click OK to save and close Preferences
-
Protect from
PsiFile
beingnull
inLocal
credo inspector -
Run
Qualified#moduleName
getText
in Read Action. -
Scratch Files have a
Project
, but not aModule
, so change flow to useProject
whenModule
isnull
in credo annotator. -
Don’t add
.bat
tomix
on Windows.mix
is never run as an executable. It is either run as a script toelixir.bat
OR as an argument toerl.exe
whenerl.exe
is runningelixir
.
phoenix_integration 0.4 published to hex
Just published phoenix_integration 0.4 to hex.
phoenix_integration is a lightweight server-side integration framework that helps you test your controllers/templates working together through a series of calls. Previously described in this blog post.
Among several bug fixes, the big change is the addition of Requests.fetch_form/2
. This lets you fish the contents of a form out of a conn that has been rendered from a controller in test. You either query/use values that were set in the app or simply verify that the preloaded values are correct.
Lesson 12 Constructing bitmap files with Elixir
youtu.be/9o5bDiCiJ90
Let’s take advantage of Elixir’s built-in binary handling and construct Win2.x bitmap files! No external dependencies needed. #nostalgia
EventBus v0.8.0 released
Your favorite event delivery library has a new version with new features. https://github.com/mustafaturan/event_bus
[0.8.0] - 2018-01-06
Added
-
Register/unregister topics on-demand (
EventBus.register_topic/1
andEventBus.unregister/1
) -
Add block/yield builder for Event with auto
initialized_at
andoccurred_at
attribute assignments - Add block/yield notifier for delivering/notifying events creation with same benefits of build block
- Add samples to README
- Add CHANGELOG file
Elixir Wants to Change the Way You Think About Programming
A look at how we think about code at 10,000ft and how learning Elixir has made me see programming differently through three key languages features: immutability, data transformations, and syntactic expressiveness.