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.
alembic 3.4.0
https://hex.pm/packages/alembic/3.4.0
Changelog
Enhancements
-
Alembic.Document.from_ecto_changeset/2
converts theerrors
inecto_changeset
toAlembic.Error.t
in a singleAlembic.Document.t
. Bypasses a bug inJaSerializer
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 theEcto.Changeset.t
data
struct module to get the__schema__/1
information from theEcto.Schema.t
. It also assumes that if the field maps to no known attribute, association or foreign key, then the error should not have anAlembic.Source.t
instead of defaulting to/data/attributes
. -
Alembic.Pagination.Page.count
calculates the number of pages given the pagesize
and thetotal_size
of resources to be paginated. -
Alembic.Pagination.Page.first
returns theAlembic.Pagination.Page.t
for thefirst
forAlembic.Pagination.t
given any page and the page count. -
Alembic.Pagination.Page.last
is the last page forAlembic.Pagination.t
given any page and the page count. -
Alembic.Pagination.Page.next
is the next page after the currentpage
. Ifpage
number
matchescount
, then it must be the last page and so next will benil
. -
Alembic.Paginaton.Page.previous
is the previous page to the currentpage
. If thepage
number
is1
, then it is the first page, and the previous page isnil
. -
Alembic.Pagination.Page.to_pagination
takes the currentpage
and thetotal_size
of resources to paginated and produces theAlembic.Pagination
withfirst
,last
,next
, andprevious
around thatpage
. Ifpage
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 errorDocument
if0
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 inAlembic.ToEctoSchema.to_ecto_schema/2
-
Alembic.ToEctoSchema.to_ecto_schema/2
doctest
s
Bug Fixes
-
Allow
next
andprevious
to benil
inPagination.t
@type
since they were already allowed to benil
in use for the last and first page, respectively. -
Alembic.Pagination.Page
number
ispos_integer
becausenon_neg_integer
allows 0, but that’s not valid becausenumber
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
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
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.
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.