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

How to run Phoenix framework application inside a Docker container?

How to run Phoenix framework application inside a Docker container? https://blog.lelonek.me/how-to-run-phoenix-framework-application-inside-a-docker-container-b02817d860b4

Nerves 0.7.1 Released

Nerves has really been moving forward quickly over the past few months. One exciting new feature that I’ve been working on is the nerves.system.shell Mix task, which allows you to more easily build custom Nerves systems regardless of what OS you’re using. Check out the updated documentation to learn more!

HTTP/2 client available from Ace > 0.11.1

The latest version of Ace includes a HTTP/2.0 client. https://hexdocs.pm/ace/Ace.HTTP2.Client.html

Do you have any questions about Elixir? Let DailyDrip know!

https://twitter.com/dailydripcom/status/893140134421557248

From zero to Production Elixir, part 2

This is the second part of the story of how we got an Elixir application running in Production in a month. This time we’re more focused on the code aspect and how we applied the umbrella apps concept. The article ends with some thoughts on how Elixir welcomes newcomers like me. https://medium.com/onfido-tech/from-zero-to-production-elixir-in-1-month-2-2-1deca839be14

National Health Service on Elixir, React and Kubernetes

The second case study how we built eHealth system for NHS of Ukraine on Elixir, React and Kubernetes. https://medium.com/nebo-15/national-health-service-on-elixir-and-kubernetes-b1c2551f0dbb

Time zones in PostgreSQL, Elixir and Phoenix

I just blogged about the way I handle time zones (specifically timestamps) in Elixir/Phoenix/Ecto applications on our corporate blog

Continuous Deployment of a Phoenix app to Heroku via Semaphore

I just released an episode showing how we’re doing continuous deployment for the Firestorm Forum to Heroku via Semaphore.

https://www.dailydrip.com/topics/elixir/drips/continuous-deployment-to-heroku

String.Naming :: fuzzy grapheme search by name

https://github.com/am-kantox/string_naming

Added StringNaming.graphemes/1 function that receives a regular expression and returns the list of matched characters:

iex> StringNaming.graphemes ~r/\Aspace/i
[
  space_medium_mathematical_space: " ",
  spaces_em_quad: " ",
  spaces_em_space: " ",
  spaces_en_quad: " ",
  spaces_en_space: " ",
  spaces_figure_space: " ",
  spaces_four_per_em_space: " ",
  spaces_hair_space: " ",
  spaces_punctuation_space: " ",
  spaces_six_per_em_space: " ",
  spaces_thin_space: " ",
  spaces_three_per_em_space: " "
]

Setting Up Continuous Integration for an Elixir Project Using Semaphore

Learn how to set up continuous integration for an Elixir Phoenix project using Semaphore. https://semaphoreci.com/community/tutorials/setting-up-continuous-integration-for-an-elixir-project-using-semaphore

Elixir with Love Conf Tickets Available

Tickets to the Elixir with Love conference go on sale today! Event: November 10, 2017 at the Providence Biltmore Hotel in Providence, RI.

How to use Phoenix with Webpack + React + Redux

https://www.dailydrip.com/blog/how-to-use-phoenix-with-webpack-react-redux

ShorterMaps 2.2 released: ES6 map shorthand for Elixir

Tired of this? %{id: id, first_name: first_name, last_name: last_name, address_1: address_1, address_2: address_2, city: city, zip_code: zip_code}

ShorterMaps provides the map syntax you wish vanilla Elixir allowed:

~M{id, first_name, last_name, address_1, address_2, city, zip _code}

Version 2.2 is a tremendous upgrade in capability: ShorterMaps now can work with expressions alongside elided keys, e.g.:

~M(id, first_name, last_name, full_name: “#{first_name} #{last_name}”)

Check it out on Github. Try it out with {:shorter_maps, “~> 2.0”},

Continuous Integration with Semaphore

DailyDrip just released a free episode covering setting up continuous integration for a Phoenix project using Semaphore CI. This is how we’re handling CI for the Firestorm Forum.

Elixir with CircleCI

How to use Elixir with CircleCI continuous integration service? https://blog.lelonek.me/elixir-continuous-integration-with-circleci-ceae93dbe011

How learning Elixr made me better Ruby developer

I wrote a blog post describing how learning Elixir made me better Ruby developer.

Previous page Next page