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.

Mock current time in Elixir

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

https://youtu.be/EKSdm11Vd0g

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/

An Intro to Agents

In the latest episode of ElixirCasts we get an intro to agents.

https://elixircasts.io/intro-to-agents

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

https://youtu.be/pTR89d1yVbk

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 documentation OrderRootType in the Erlang SDK Type, so that it works in Small IDEs that have more than CLASSES and SOURCES root types installed.

  • The credo annotator is disabled by default as numerous users find running mix 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.

    1. Preferences > Editor > Inspections > Elixir
    2. Check “Credo”
    3. 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.
    4. Preferences > Editor > Inspections > Elixir
    5. Uncheck “Credo”
    6. Click OK to save and close Preferences
  • Protect from PsiFile being null in Local credo inspector

  • Run Qualified#moduleName getText in Read Action.

  • Scratch Files have a Project, but not a Module, so change flow to use Project when Module is null in credo annotator.

  • Don’t add .bat to mix on Windows. mix is never run as an executable. It is either run as a script to elixir.bat OR as an argument to erl.exe when erl.exe is running elixir.

Installation Instructions

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 and EventBus.unregister/1)
  • Add block/yield builder for Event with auto initialized_at and occurred_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.

Elixir Wants to Change the Way You Think About Programming

Previous page Next page