Posts with the tag elixir:

Rill Stage 1

The goal of the project Rill is to collect data about online streams from Twitch (and, possibly, other streaming platforms) for further analysis. Set up Twitch client ID according to: http://blog.danielberkompas.com/elixir/2015/03/21/manage-env-vars-in-elixir.html The process to obtain data about streams for a particular user looks like this: Find user’s username (e.g., from a Twitch URL) Make a request to Twitch API to convert username to stream id. Make a request to Twitch API to obtain data about user’s stream (is there a live steam, is there a recording being played) In stage 1 we will write a simple functions to explore Twitch API.

Luhn algorithm in Elixir: implementation, refactoring, and benchmarking

Some time ago, I have encountered a programming exercise in which the goal was to implement Luhn algorithm for credit card number validation. At first I implemented the algorithm in Ruby and then decided to implement it in Elixir. Eventually, I like how Elixir version looks like. In this article Elixir 1.2.2 is being used. Initial version It is assumed that credit card numbers are being read from a file and that check digit is included in a credit card number. The Luhn algorithm is quite straightforward. Description from Wikipedia 1: The formula verifies a number against its included check digit, which is usually appended to a partial account number to generate the full account number.

A challenge: remove tags from a string.

Recently I have implemented a small piece of functionality, which is suitable to be a small challenge. Description Given a string with opening and closing tags (e.g., <mark></mark>), return a string without tags and indices of opening and closing tags. For example, given a string: "we eat <mark>healthy</mark> and <mark>tasty</mark> food." We expect to receive a string: "we eat healthy and tasty food.", and an array with pairs of indices: [[7, 14], [19, 24]]. There are two pairs of indices, because there were two pairs of <mark></mark> tags. Ruby First, I tried to solve this problem imperative way, which did not work very well.