Open-sourcing @CaptainFact_io backend (Elixir, Phoenix, Absinthe)

A year and a half ago started https://captainfact.io - a collaborative, real-time fact-checking tool for YouTube videos. The website allow people to work together to confirm, refute and contextualize statements made in a video. A browser extension then brings down the community’s sources directly on the content by injecting them into YouTube’s player ( preview ).

Website previewYoutube integration preview

The project is non-profit ( we accept donations through OpenCollective ). We want to work in full transparency and while the website and the extension have been open-source for a long time, we still needed to release the API. It is now available on Github: https://github.com/CaptainFact/captain-fact-api.

The project is organized as an umbrella app and based on Phoenix + Absinthe. Some of its core features are:

  • A REST API (progressively migrated to GraphQL with Absinthe)
  • A Websocket API to work on videos in real-time
  • A reputation system with associated permissions and daily limits
  • A collective moderation system with flag reasons
  • Users actions history
  • Achievements
  • An invitation system (disabled by default)

Contributors and supporters are welcome and we hope the Elixir community will benefit from this project. As of today CaptainFact only has partnerships with French Youtubers and most of the videos presented on the platform are in French too. If you’re interested in contacting your favourite Youtuber to convince him / her that his videos should be added for sourcing on CaptainFact, contact us and we’ll tell you everything you need to know to get started.

Blazing fast Elixir configuration

Blazing fast Elixir configuration https://engineering.tripping.com/blazing-fast-elixir-configuration-475aca10011d

Display channel users count with Elixir/Phoenix + React/Redux

A few months ago, we decided to implement a users count feature on CaptainFact’s videos pages. It had to be reliable, light and simple. We also wanted to differentiate between logged-in and anonymous users.

The most interesting read I had at the time on this subject was a medium article which has one major flaw: the full users list is returned from the backend and the count occurs on the frontend (which actually respects the default behaviour of Phoenix.Presence).

Depending on your business, it can represent a privacy issue (you don’t especially want anyone to be able to know who’s connected to your channel) as well as a performance issue.

In the following article, I’ll show you how I implemented Phoenix.Presence in such a way that it only returns the total of connected / anonymous users. We’ll then see how to bind it to Redux.

https://blog.benjamin.piouffle.com/display-channel-users-count-elixir-phoenix-react-redux/

ElixirWeekly: The Elixir Community Newsletter, covering community news you easily miss, shared on ElixirStatus and the web, in one email every Thursday.

MapRewire <~>: Syntactic sugar to quickly bulk rekey maps

Simple sugar to make changing keys on maps less ugly.

What’s the why? When you consume information from a lot of API’s/sources, you get data streaming in with the keys from other applications, other applications naming conventions might not fit your app.

left <~> right, left is your map from outside your app, right is the rewrite rules.

It looks a little something like this: %{"id"=>"234923409", "title"=>"asdf"}<~>["title=>name", "id=>shopify_id"]

Rewrite rules can be an Elixir List or a whitespace-separated list. They follow a format of left=>right, left is the old key, and right representing the new.

Add it as a dep: {:map_rewire, "~> 0.1.0"}

Hex.pm ~~ GitHub

Talk: Embedded Elixir with Nerves - Code BEAM STO

My recent Nerves talk from Code BEAM STO: https://www.youtube.com/watch?v=IVCQvcCEjkU Want to learn more? Sign up for Nerves training at ElixirConf!

Spawning linked processes in Elixir

In this short episode, we continue exploring Elixir processes.

We build a countdown timer and another function that spawns it as a linked process. We see what happens when a linked process dies and how to handle such events without killing the parent process.

ELIXIR/PHOENIX MIX TIP #2: MIX DEPS.UNLOCK

Excerpt:

But what if you would like to clean out your mix.lock file?

You know the drill, you stumble across some tutorial to do something you’d like to add to your Phoenix app, you update dependencies, try it out, then maybe decide it’s not what you want, or worth the effort.

Read on to clean out your mix.lock file

Win a copy of Phoenix in Action

SmoothTerminal is giving away a copy of Phoenix in Action!

Phoenix in Action is an example-based tutorial that teaches you how to use the Phoenix framework to build production-quality web apps.

What I have learned working 1 year full-time using Elixir

I wrote a blog post to wrap up my year as full-time Elixir developer, hope you like it https://medium.com/@lorenzo_sinisi/what-i-have-learned-working-1-year-with-full-time-using-elixir-51efd4c1f66

Shameless plug: Check out @elixirstatus' other community project:

Credo, a new static code analysis tool that acts as a code linter, but also focusses on teaching coding practices and code consistency.

IntelliJ Elixir 8.0.0

  • New and improved Run/Debug configurations:

    • Distillery Release CLI,
    • elixir
    • iex
    • mix
    • mix test
    • iex -S mix.
  • Evaluate in the debugger.
  • More module filtering controls for debugger.
  • Elixir 1.7 compatibility for debugger.
  • All OTP 21 bytecodes can be disassembled.
  • Spell Checking

Installation Instructions

Algorithmically Fingering Guitar Chords with Elixir

Piggy-backing off my last post on generating all possible voicings for a given guitar chord, this week I used a “sieve”-inspired algorithm to generate all possible* fingerings for a given chord.

  • For some values of “possible.”

Early Bird Pricing to GigCityElixir ends today

It’s an excellent conference season and GigCityElixir is going to make your choices even harder. We’re bringing John Hughes (one of the creators of Haskell), Chris McCord (Phoenix), Prag Dave, James E Gray II and Bruce Tate with many others to scenic Chattanooga. https://www.gigcityelixir.com/

Performing Bulk Updates using Ecto and Elixir

Performing bulk updates with Ecto and Elixir can be a pain. I compare three ways that you can do them. https://adamdelong.com/bulk-update-ecto

A Proposal: Elixir-Style Modules in JavaScript

Organizing our Elixir code into modules, with related structs and functions all in one place, is great. Why not do that in JavaScript too?

https://blog.carbonfive.com/2018/08/13/a-proposal-elixir-style-modules-in-javascript

Cognitex - Library for managing user acounts through AWS Cognito service.

I have recently created a small library for managing user accounts through AWS Cognito service.

Cognitex

The following functionality is covered;

  • User registration
  • Confirm registration (with the confirmation code received from AWS, by email)
  • User authentication
  • Fetch user data by an access token
  • Fetch user data by username
  • Change user password
  • Update user attributes
  • Reset a forgotten password

Link to project https://github.com/Skoda091/cognitex

Elixir Cowboy Websocket Handler

For my side project Gossip, I wanted to have a websocket connection for non-Phoenix connections. To do this I used Cowboy to create a socket handler.

https://blog.oestrich.org/2018/08/cowboy-websocket-handler/

Control one process with another (challenge solution)

Solution to Processes Challenge 1: Control one process with another

The challenge from last time was to create a module with two spawnable processes. One process is a counter and the second is a controller that spawns, starts it and terminates the counter.

Elixium - A fast, anonymous, and scriptable blockchain written in Elixir

https://github.com/ElixiumNetwork/elixium_core

Win a ticket to The Big Elixir Conference

SmoothTerminal is giving away two tickets to The Big Elixir conference in New Orleans, November 8-9!

I’m a keynote speaker (first time!) so I’m super excited to meet up with people there and see old friends!

Generating Excel Friendly CSV Exports with Elixir

Microsoft Excel and CSV don’t always play nicely together, especially when there’s non-ASCII characters involved.

Here’s an overview of how to generate CSV files that work well with Excel:

https://underthehood.meltwater.com/blog/2018/08/08/excel-friendly-csv-exports-with-elixir/