Beefing Up our Bitcoin Node with Connection
This week I decided to beef up our in-progress Elixir-based Bitcoin node by swapping out the GenServer behavior with the more sophisticated Connection behavior. This lets us be much more nuanced in how we handle problems when connecting to peer nodes.
Elixir — quick reference for debugging techniques
Much has been said about Elixir debugging techniques, but in this post, I’d like to give a quick overview of all possible options to serve as a go-to reference when you need to debug Elixir code. https://medium.com/@leandrocesquini/elixir-quick-reference-for-debugging-techniques-8dad3920ab93
Going Multi-Node with Elixir
Last month ExVenture, a multiplayer text-based game server, went distributed . This is a blog post showing that journey and how simple it ended up being.
On Guarantees of Phoenix Presence
Phoenix Presence if awesome! But it’s important to know about its tradeoffs and limitations before deciding to use it. https://medium.com/@mkaszubowski/on-guarantees-of-phoenix-presence-a4a23c24667f
Your Elixir bucket for debugging
Your Elixir bucket for debugging https://minhajuddin.com/2018/05/17/your-elixir-bucket-for-debugging/ Put your variables and pids in your bucket :D
WechatPay v0.6.0 has been released!
WechatPay is a toolkit for the Wechat Payment Platform.
v0.6.0 ships with a flexible configuration system which make it possible to use WechatPay in a multi-tenancy application. Also, the HK and US nodes are supported in this version.
Full changelog: https://github.com/linjunpop/wechat_pay/blob/master/CHANGELOG.md#v060
Run specific tests in a phoenix project more conveniently
While refactoring a phoenix application, lazy me figured typing the full path to a test was terribly annoying. So here’s mix_phxtest, a helper package to allow running specific tests with shorter commands.
WebSocket security with Phoenix Channels
We’ve recently gone through a round of pen testing and had to deal with feedback on our use of WebSockets. Here is what we’ve done to get the WebSocket code to pass those pen tests
When to use Elixir language?
I have been asked multiple times recently questions about Elixir and if it’s a good fit for different projects. Let’s try clearing a few things out
ElixirCasts: Ecto Virtual Attributes
In episode #46 we’ll look at how we can use virtual attributes in Ecto to create fields in a schema that we don’t want persisted to the database.
External Service Testing in Phoenix
How to mock external service in test
https://thefirstapril.com/2018/05/14/External-service-testing-in-Phoenix/
Odometex, simple distance comparisons
Just published Odometex v0.1.0, simple distance comparisons for Elixir! 🌍🚶♂️🏃♀️
iex> Odometex.compare(7000)
# => [
%Odometex.Result{label: "Central Park, New York", meters: 4000, times: 1.75},
%Odometex.Result{
label: "Champs-Élysées, Paris",
meters: 1910,
times: 3.664921
},
%Odometex.Result{
label: "Passeig de Gràcia, Barcelona",
meters: 1300,
times: 5.384615
},
%Odometex.Result{label: "Football pitch", meters: 105, times: 66.666667},
%Odometex.Result{label: "Basketball court", meters: 28, times: 250.0}
]
Any feedback or distance request is more than welcome!
Juice - Reduce in memory data structures using a lightweight query language
https://github.com/rupurt/juice
Juice can collect and reject string or atom keys from an Elixir Map or List.
Given the map
iex> fruit_basket = %{
apples: {
granny_smith: 10,
golden_delicious: 3
},
"oranges" => 5,
plums: 6,
"mangos" => 2,
recipients: [:steph, "michael", :lebron, "charles"]
}
Return everything with a wildcard *
iex> Juice.squeeze(fruit_basket, "*") == %{
apples: {
granny_smith: 10,
golden_delicious: 3
},
"oranges" => 5,
plums: 6,
"mangos" => 2,
recipients: [:steph, "michael", :lebron, "charles"]
}
Remove plums
and mangos
iex> Juice.squeeze(fruit_basket, "* -plums -mangos") == %{
apples: {
granny_smith: 10,
golden_delicious: 3
},
"oranges" => 5,
recipients: [:steph, "michael", :lebron, "charles"]
}
Only collect granny_smith
apples
and oranges
with nested .
notation
iex> Juice.squeeze(fruit_basket, "apples.granny_smith oranges") == %{
apples: {
granny_smith: 10,
},
"oranges" => 5
}
Collect plums
and mangos
for charles
iex> Juice.squeeze(fruit_basket, "plums mangos recipients.charles") == %{
plums: 6,
"mangos" => 2,
recipients: ["charles"]
}
Setting up Brotli on Nginx or Phoenix
Brotli is a relatively new compression format that has two big advantages over gzip. It’s faster at compressing things and it compresses them down to nearly ~25% smaller files!
Let’s set up our Nginx server to serve brotli compressed HTML, CSS, JS and JSON assets! If you’re running Phoenix, Rails, Django, Node or anything else behind an Nginx proxy, this setup should work for you.
A basic strategy is also covered for serving brotli compressed assets from a Phoenix server running directly on the server without anything proxying in front of it.
Elixir Protocols: a gentle introduction
Protocols are one of the more important but less publicized features of Elixir.
That’s why this lesson focuses on them directly rather than being part of a larger project. It explores defprotocol, fallback_to_any, defdelegate and working with structs.
Reversing BIP-39 and the Power of Property Testing
While building and testing a decoder to go along with the Bitcoin BIP-39 encoder we wrote a few weeks back, a simple property test uncovered a bug in our original implementation that I never would have caught through manual testing.
I’m blown away.
Check out the full article for a rundown on my property testing experience, and the full implementation of the decoder: Reversing BIP-39 and the Power of Property Testing.
Ethereum's Recursive Length Prefix encoding in Elixir
Ethereum’s Recursive Length Prefix encoding in Elixir Implementing RLP with recursive protocols
AlloyCI v0.6.0 released!
AlloyCI v0.6.0 has been released. The biggest change since last release is that it now supports any S3 compatible storage service, in order to store any build artifacts generated by your project. Check it out! https://github.com/AlloyCI/alloy_ci/releases/tag/v0.6.0
Plugs demystified
An entry-level introduction to Plug - build a simple website without using Phoenix.