A logger backend for Telegram | LoggerTelegramBackend v1.0
Just published logger_telegram_backend v1.0, a logger backend for Telegram with support for multiple logger handlers and metadata filtering.
Check it out: https://github.com/adriankumpf/logger-telegram-backend
Phoenix & Elm landing page (pt.3)
Here is the last part of my Phoenix and Elm landing page series, where we add Google reCAPATCHA support to the subscription form to avoid spambots.
http://codeloveandboards.com/blog/2018/01/06/phoenix-elm-landing-page-pt-3/
Happy coding!
Lesson 13 Adding Ecto and a Postgres database to StatWatch
Our StatWatch module has been serving Alchemist.Camp well, but let’s add a database and work towards eliminating our reliance on .csv files.
This is our first video to cover Ecto so we went into some detail about getting it set up, creating a user for our db in psql, running various Ecto mix tasks, setting up an Ecto Schema for our table, and then doing basic CRUD from inside iex before jumping into the application’s code.
Finally we dealt with a common mix error that comes up when using ecto in an otp sub-application that’s not an umbrella project.
Today’s challenge: Read over the docs on Ecto Associations (https://hexdocs.pm/ecto/associations.html#content)
Then figure out how we could create an association between the profiles we’re collecting stats for and the stats we’ve collected.
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
documentionRootTypeto indirectly get the documentationOrderRootTypein the Erlang SDK Type, so that it works in Small IDEs that have more thanCLASSESandSOURCESroot types installed. -
The
credoannotator is disabled by default as numerous users find runningmix credoin 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
PsiFilebeingnullinLocalcredo inspector -
Run
Qualified#moduleNamegetTextin Read Action. -
Scratch Files have a
Project, but not aModule, so change flow to useProjectwhenModuleisnullin credo annotator. -
Don’t add
.battomixon Windows.mixis never run as an executable. It is either run as a script toelixir.batOR as an argument toerl.exewhenerl.exeis 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.
