Factor Girl with CouchDb persistence
After building my first API in Phoenixframework which serves CouchDb data to an iOS app. I found my self missing FactoryGirl. I found factory_girl_elixir, which I tried to use for persisting my couch data for testing, but didn’t like the API. So I decided to try my own implementation, for practical and didactic purposes.
Now it does simple factories that persist. But plan to add more features soon.
Benchmark Helloworld in different frameworks
When I started with Elixir and Phoenix I wanted to see with my own eyes the speed of functional approach and Erlang in comparing with other well known languages. I just want to compare the simplest possible „Hello world“ in Javascript, PHP and Elixir.
So well, the fully featured fat-lady framework Phoenix with its rounting, view, layout and template runs at the same speed like a pure NodeJS with http. And PHP plain just returning a string is not significant faster.
http://blog.rh-flow.de/2015/10/08/benchmark-helloworld-in-different-frameworks-myelixirstatus/
New Elixir TCP small message experiment reaches 100k msg/sec (by @dbeck74)
This is my second part of my experiments with Elixir TCP server programming. I am still learning this. The good news is that my msg server improved 4x over the previous one:
http://dbeck.github.io/Four-Times-Speedup-By-Throttling/
The previous one did only 22k messages / sec:
http://dbeck.github.io/simple-TCP-message-performance-in-Elixir/
Beware! I am still an Elixir beginner, don’t copy codes into production from these posts. Thank you all the nice feedbacks!
Nested Forms Part 2
Dynamic nested forms
Inspiration: http://blog.plataformatec.com.br/2015/08/working-with-ecto-associations-and-embeds/ Source: https://github.com/cas27/nested
Recently released: ExMachina, a library for generating test data
Hey everyone! We’ve been working on a factory library called ExMachina: https://github.com/thoughtbot/ex_machina
We’ve been using it on a few internal projects. Here’s what we think you’ll like.
- Makes it easy to work with belongs_to associations
- Easy to pipe records through functions
- Simple API with as few macros as possible
You can do cool things like
factory :user do
%User{
name: "Johnny",
email: sequence(:email, &"email-#{&1}@example.com")
}
end
def make_admin(user) do
%{user | admin: true}
end
def with_article(user) do
create(:article, user: user)
user
end
build(:user) |> make_admin |> create |> with_article
Phoenix Nested Forms Part 1
Going over the basics of a has_many / belongs_to association and their nested form using phoenix.
Writing a Blog in Phoenix and Elixir Tutorial Part 2: Authorization
I just created the second part of my blog tutorial in Phoenix, this time covering authorization, associations, and more testing!
https://medium.com/@diamondgfx/writing-a-blog-engine-in-phoenix-part-2-authorization-814c06fa7c0
Elixir Logger
Overview of the elixir logger used by Phoenix, filtering parameters in your log and how to go about writing your own logging backend.
Debugging with Phoenix
Learn how to debug a phoenix app, in-line inspection and configuring your IEx session to make things faster.
TCP Roundtrip performance experiment with small TCP messages (by @dbeck74)
I sent messages in a loop to an Elixir TCP server which sent back an ACK in turn. I was interested to see how many roundtrips would go per second. This is a non-scientific experiment to get an idea about the performance of this scenario.
http://dbeck.github.io/simple-TCP-message-performance-in-Elixir/
Just Pushed a Membership Backend Store
My weekend project, and I love it: https://github.com/bigmachine-io/blackbook.
Handles the basics of a membership system (no UI, just data etc).
Functors, Applicatives, and Monads in Elixir
Join me as I take an exploratory look into the subject using protocols in place of Haskell’s type classes.
http://www.slogsdon.com/functors-applicatives-and-monads-in-elixir/
Serial Deprecator Jose Valim Strikes Again!
In the wake of ElixirConf 2015 and Jose Valim’s keynote address outlining the future of the language, many are left to wonder if Valim is the most dangerous language designer alive today. How many features can one man deprecate before he is stopped?
RIP HashSet, HashDict, Set, and Dict. You will be missed. By some.
Instagram client for Elixir (with Phoenix auth example app)
I made a nice API client for Instagram called Elixtagram
Also includes a Phoenix user authentication example :)
A More Complete Library for Stripe
I’ve been looking for a Stripe Library over the past week and each one I looked at fell short in some regard. Most were “very alpha”, some had no tests, others isn’t even build. I first went the route of trying to fork/help but soon found myself reworking the API (instead of just mirroring a REST client) and so I decided to just go my own direction.
The repo is here and the package itself is here.
This is my first Elixir package so there might be some rough spots… in fact I’m sure of it!
The API is essentially what you would expect:
Stripe.Customers.create_subscription("customer_id","test-plan", [options])
ExCasts: Elixir screencasts for all skill levels
This week, Jason Harrelson and I started a new Elixir-based screencast service. We produce bite-sized, introductory screencasts as well as longer, more involved series aimed toward intermediate and advanced Elixir developers. All screencasts are currently free (as of 10/2/15).
Now Power Assert is available on Elixir
Power Assert provides descriptive assertion messages like the following.
1) test Enum.at should return the element at the given index (PowerAssertTest)
array |> Enum.at(index) == two
| | | |
| | | 2
| | 2
| 3
[1, 2, 3]
It’s easy to use your project. You only replace ExUnit.Case into PowerAssert.
This commit shows how to use PowerAssert.
Enjoy!
Using ranch, the high performance acceptor pool from Elixir
This is an early morning experiment with Erlang and Elixir integration:
Video on Virtual Attributes w/ Phoenix and Ecto
Tried my hand at making a screencast. Will work on better format next time!
https://www.youtube.com/watch?t=392&v=_7NNJLhAQ1k
