Skip to content

Instantly share code, notes, and snippets.

View colinbankier's full-sized avatar

Colin Bankier colinbankier

  • Brisbane, Australia
View GitHub Profile
@colinbankier
colinbankier / elchemy_deps.exs
Created November 28, 2017 12:34
Elchemy Find Deps
defmodule Elchemy.LocalDeps do
def find!(dir), do: find!([], dir)
def find!(dirs, dir) do
files = dir |> File.ls!
if Enum.member?(files, "mix.exs") do
[dir | dirs]
else
files
|> Enum.map(&Path.join(dir, &1))
|> Enum.filter(&File.dir?/1)
@colinbankier
colinbankier / frequency.erl
Created April 25, 2017 13:34
Frequency server supervisor
%% Based on code from
%% Erlang Programming
%% Francecso Cesarini and Simon Thompson
%% O'Reilly, 2008
%% http://oreilly.com/catalog/9780596518189/
%% http://www.erlangprogramming.org/
%% (c) Francesco Cesarini and Simon Thompson
-module(frequency).
-export([start/0,allocate/0,deallocate/1,stop/0, client/1, supervisor_start/0]).
@colinbankier
colinbankier / frequency.erl
Created April 21, 2017 13:43
Frequency Server
%% Based on code from
%% Erlang Programming
%% Francecso Cesarini and Simon Thompson
%% O'Reilly, 2008
%% http://oreilly.com/catalog/9780596518189/
%% http://www.erlangprogramming.org/
%% (c) Francesco Cesarini and Simon Thompson
-module(frequency).
-export([start/0, init/0, allocate/0, deallocate/1]).
@colinbankier
colinbankier / index.erl
Created March 8, 2017 12:45
Indexing a file - Erlang
-module(index).
-export([get_index/1]).
% Used to read a file into a list of lines.
% Example files available in:
% gettysburg-address.txt (short)
% dickens-christmas.txt (long)
% Get the contents of a text file into a list of lines.

Put a plug in it!

Plug

Elixir News

Latest release v1.2.2. 1.2.x brought us: Erlang 18 support

  • Faster compile times
  • Maps now support millions of keys efficiently - Dict/HashDict/Set/HashSet deprecated.

Concurrency: the reason we're here

A bit of background

In Elixir, all code runs inside processes. Processes are isolated from each other, run concurrent to one another and communicate via message passing. Processes are not only the basis for concurrency in Elixir, but they also provide the means for building distributed and fault-tolerant programs.

Elixir’s processes should not be confused with operating system processes. Processes in Elixir are extremely lightweight in terms of memory and CPU (unlike threads in many other programming languages). Because of this, it is not uncommon to have tens or even hundreds of thousands of processes running simultaneously.

Processes

The most basic mechanism for creating processes is using the spawn/1 function:

Brisbane Elixir elixir

July 23, 2015

General

Welcome newcomers!

Introducing Card Shark card shark

Last meetup Mark walked us through creating a RESTful database application in Phoenix, from scratch. We played with the HTML and JSON generators that ship with Phoenix to create a simple CRUD app. We want to keep building

  • Deployment Pipeline (re-instate)
    • CI (shippable or semaphore) triggers pipeline on successful master build
      • Probably 'Go' - has misgivings but does the job for now
    • builds and pushes docker container artifact
    • deploy to staging
      • smoke test
      • acceptance test
    • Deploy to prod (auto-deploy can be optional e.g. supporter)
      • smoke test
  • Rollback on failure