GenStage by Example: episodes 1-5

My first set of screencasts on GenStage. Episodes 1-5 focus only on the basics and how things work.

https://stuffbyexample.com/genstage

A year of Elixir

Reflection on a year of being part of Elixir’s excellent community

https://labs.uswitch.com/a-year-of-elixir/

ElixirScript 0.30.0 Released

ElixirScript 0.30.0 has been released and contains lots of exciting changes.

https://elixirscript.github.io/post/elixirscript-0.30.0-released/

ElixirWeekly: The Elixir Community Newsletter, covering community news you easily miss, shared on ElixirStatus and the web, in one email every Thursday.

Sentry.io inside Docker with Elixir

How to use sentry.io with Elixir inside a Docker container?

https://blog.lelonek.me/how-to-use-sentry-io-with-elixir-in-docker-8374e695f706

Recurring tasks in Elixir: Solution #2

In my blog post, I consider a solution based on a timeout which can be defined for a GenServer process.

https://nesteryuk.info/2017/08/13/recurring-tasks-in-elixir-solution-2.html

OPQ: A simple, in-memory queue with worker pooling and rate limiting

A simple, in-memory queue with worker pooling and rate limiting in Elixir. OPQ leverages Erlang’s queue module and Elixir’s GenStage. Originally built to support Crawler.

Check it out: https://github.com/fredwu/opq

Simple impersonation with Guardian

Manage multiple sessions and impersonate as other users with Guardian

http://undefinedmethod.com/blog/simple-impersonation-with-guardian/

IntelliJ Elixir v6.1.0

  • Debugger setup fix

Installation Instructions

First impressions of property testing with StreamData

I haven’t done any property based testing before, so this is obviously quite basic. But I spent half of yesterday playing with the new StreamData library and thought I’d post a little write-up on that.

http://bit.ly/2w107UA

Shameless plug: Check out @elixirstatus' other community project:

Credo, a new static code analysis tool that acts as a code linter, but also focusses on teaching coding practices and code consistency.

IntelliJ Elixir v6.0.0

  • Formatter
  • Parallel test reporting
  • OTP 20 support for AtU8 chunk decompilation
  • Nix and NixOS support on Mac and Linux
  • Mix path quoting fix on Windows
  • Reference caching for performance improvements

Installation Instructions

Hulaaki v0.1.0 released - an #MQTT protocol library for #Elixir

An Elixir library (driver) for clients communicating with MQTT brokers(via the MQTT 3.1.1 protocol). - https://github.com/suvash/hulaaki/

View the complete changelog at https://github.com/suvash/hulaaki/blob/master/CHANGELOG.md

[0.1.0] - 2017-08-12

Added

  • Added link to CHANGELOG in the README
  • Add instructions on using Makefile for running tests.
  • Handle gen_tcp connection failures instead of crashing
  • Add automatic ping to server (based on keep alive) and expect ping response with callbacks
  • Handle packet ids internally (for control packets with variable header)
  • Adds TLS/SSL support for the library
  • Implement chunked message receiving so as to parse packets sent together

Fixed

  • Replaces all occurences of 65_536 to 65_535 (max limit for 2 bytes)

ParallelTask: easily run functions in parallel and capture the results

A library for easily parallelizing slow tasks such as API requests, database queries and the like.

https://github.com/Fabianlindfors/parallel_task

Inspired by Ryan Sydnor’s article Reducing Elixir Backend Time From 120ms to 20ms With Parallelization.

Using GenServer :via

I have two GenServers that use the same handle_* interface so I figured out how to use :via to talk to either through the same means.

https://blog.oestrich.org/2017/08/genserver-via/

ReceiptDecoder: Decode iOS App receipt

ReceiptDecoder is a tool to decode iOS App receipt in Elixir. You can do some validation before sending receipt to remote server.

https://github.com/linjunpop/receipt_decoder

Benchmarking in Elixir

Ready to measure the performance of two pieces of code w/ the same output? Check out the latest episode: Benchmarking with Benchee https://elixircasts.io/benchmarking-with-benchee

What if Elixir were Homoiconic?

This article explores the misconception that Elixir is homoiconic, dives into what “homoiconic” actually means, and envisions what Elixir would look like if it truly were a homoiconic language.

Hammer: an elixir rate-limiter with pluggable backends

Hammer is a rate-limiter for Elixir, with a modular backend system, so you can choose where to persist the rate-limit counters. Currently supported backends are ETS and Redis.

https://github.com/ExHammer/hammer

alembic 3.4.0

https://hex.pm/packages/alembic/3.4.0

Changelog

Enhancements

  • Alembic.Document.from_ecto_changeset/2 converts the errors in ecto_changeset to Alembic.Error.t in a single Alembic.Document.t. Bypasses a bug in JaSerializer where it assumes all fields that don’t end in _id are attribute names, which leads to association names (as opposed to their foreign key) being put under /data/attributes. Alembic.Document.from_ecto_changeset reflects on the Ecto.Changeset.t data struct module to get the __schema__/1 information from the Ecto.Schema.t. It also assumes that if the field maps to no known attribute, association or foreign key, then the error should not have an Alembic.Source.t instead of defaulting to /data/attributes.
  • Alembic.Pagination.Page.count calculates the number of pages given the page size and the total_size of resources to be paginated.
  • Alembic.Pagination.Page.first returns the Alembic.Pagination.Page.t for the first for Alembic.Pagination.t given any page and the page count.
  • Alembic.Pagination.Page.last is the last page for Alembic.Pagination.t given any page and the page count.
  • Alembic.Pagination.Page.next is the next page after the current page. If page number matches count, then it must be the last page and so next will be nil.
  • Alembic.Paginaton.Page.previous is the previous page to the current page. If the page number is 1, then it is the first page, and the previous page is nil.
  • Alembic.Pagination.Page.to_pagination takes the current page and the total_size of resources to paginated and produces the Alembic.Pagination with first, last, next, and previous around that page. If page number is greater than the calculated page count {:error, Alembic.Document.t} is returned instead of {:ok, Alembic.Pagination.t}.
  • Alembic.FromJson.integer_from_json
  • Alembic.FromJson.integer_to_positive_integer takes an integer and returns it if positive, otherwise returns error Document if 0 or below.
  • Alembic.Pagination.Page.from_params parses param format with quoted integer page number and size or JSON format with integer page number and size.
  • Allow pagination opt-out with %{"page" => nil}. Alembic.Pagination.Page.from_params(%{"page" => nil}) will return {:ok, :all} while no "page" param will return {:ok, nil}.
  • Use IntelliJ Elixir formatter for make the formatting consistent
  • Support many_to_many associations in Alembic.ToEctoSchema.to_ecto_schema/2
  • Alembic.ToEctoSchema.to_ecto_schema/2 doctests

Bug Fixes

  • Allow next and previous to be nil in Pagination.t @type since they were already allowed to be nil in use for the last and first page, respectively.
  • Alembic.Pagination.Page number is pos_integer because non_neg_integer allows 0, but that’s not valid because number is 1-based, not 0-based.

Elixir for the Little Things

You don’t have to have a big problem to use a great language. Elixir shines at scripting, too

Elixir and Doctest - Help Writing Better Programs, One Method At A Time

Sometimes it’s the small things that you find enjoyable, like… having Doctest. ;)

http://fredwu.me/post/163901408538/elixir-and-doctest-help-writing-better-programs