Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View andytill's full-sized avatar

Andy Till andytill

View GitHub Profile

Code review practices

The following is meant to be a set of guidelines, not dogma. Use your best judgement. The goal is threefold, to have a practice for engineers to learn about what we collectively care about. To maintain quality of the code base as well as knowledge sharing about our systems.

Role of the author

  • Create PR, make sure to include JIRA ticket if such exists in the description or title of PR
  • Assign 2 developers as minimum but can include the whole team if the author feels it's needed.
  • Answer any questions the reviewer has.
  • Push changes after review is done as a new commit and make sure reviewer and yourself are satisfied with the change.
@larshesel
larshesel / unlocking-the-superpowers-of-the-erlang-vm.txt
Last active November 20, 2017 11:23
unlocking-the-superpowers-of-the-erlang-vm.org
* Unlocking the super-powers of the Erlang VM
Lars Hesel Christensen
VerneMQ Engineer
twitter: @larshesel
✉ lars@vernemq.com
✉ lhc@larshesel.dk
github.com/larshesel
@jadeallenx
jadeallenx / discussion.md
Last active April 21, 2023 17:13
When does terminate/2 get called in a gen_server?

When does terminate/2 get called in a gen_server?

This is what the [official documentation][1] says about the terminate/2 callback for a gen_server:

This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.

Reason is a term denoting the stop reason and State is the internal state of the gen_server.

Reason depends on why the gen_server is terminating. If it is because another callback function has returned a stop tuple {stop,..}, Reason will have the value specified in that tuple. If it is due to a failure, Reason is the error reason.

@seancribbs
seancribbs / ifelse.erl
Last active December 4, 2020 05:37
IF / ELSE in erlang, via parse_transform. EVIL, DO NOT USE
%% @doc A VERY EVIL parse_transform that allows two things:
%%
%% 1) The use of 'else' instead of 'true' in the final clause of an if
%% expression.
%%
%% 2) Automatic extraction of non-guard expressions into
%% anonymous variables that can then be used directly in the clause
%% guards.
%%
%% Until Erlang actually implements the 'cond' construct, this is a
@xandkar
xandkar / labeled_and_optional_args_in_erlang.md
Last active August 29, 2015 14:17
Labeled (and optional) arguments in Erlang

One of the things I found myself wishing I had in Erlang was labeled arguments. Even with common operations from stdlib (like lists:foldl) - I constantly forget the correct order of arguments, and it becomes that much more error-prone in complex cases (see cowboy_req:new/14, for instance).

Another desirable feature is optional arguments, which are assigned a default value when omitted.

It turns-out that the semantics of these requirements are fully met by records!

@andytill
andytill / Erlang Project Ideas.md
Last active February 20, 2023 06:00
Erlang Project Ideas

When I started erlang, I had a hard time thinking of ideas for projects to improve my skills. Now I have way too many ideas to possibly implement Myself. Since I actually want these projects to exist so I can use them (everlasting glory coming secondary to some handy tools) I have written them up here. Feel free to try them out. I'm open to questions and suggestions.

swagger for erlang

swagger is a JSON spec for REST APIs. Once you have written a spec in swagger, it can generate documentation (demo) and REST handlers.

An erlang swagger library should take swagger specs and generate cowboy_rest handlers for them.

Difficulty: low

@lpgauth
lpgauth / gist:2b3220f4bceeed6f62d0
Created July 18, 2014 18:11
HiPE lock contention
(rtb-gateway@h033.bloomdigital.com)9> lcnt:start(), lcnt:rt_opt({copy_save, true}), lcnt:clear(), timer:sleep(250), lcnt:collect(), lcnt:conflicts().
lock id #tries #collisions collisions [%] time [us] duration [%]
----- --- ------- ------------ --------------- ---------- -------------
hipe_mfait_lock 1 156537 156367 99.8914 2832642 1119.0905
pollset 1 5002 195 3.8984 17340 6.8505
drv_ev_state 16 6683 46 0.6883 2031 0.8024
timeofday 1 10206 301 2.9492 602 0.2378
run_queue 28 62350 107 0.1716 122 0.0482
timer_wheel 1 9350 123 1.3155 114 0.0450
proc_link 8902 21641 16 0.0739 91 0.0360
import edu.uci.ics.jung.algorithms.layout.CircleLayout;
import edu.uci.ics.jung.algorithms.layout.Layout;
import edu.uci.ics.jung.graph.Graph;
import edu.uci.ics.jung.graph.util.TestGraphs;
import java.awt.Dimension;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.stage.Stage;
@cpdean
cpdean / doge.md
Last active November 21, 2021 08:51
YOU'RE WELCOME, INTERNET. -- if you search for an ascii doge, you don't get anything great that you can copy paste. found a silly gif (http://cmang.org/ascii/cm-doge-bw.gif) and i have transcribed it for all of you

no clue who made this, but ARTIST FOUND thank you @indyjoenz / cmang!

i have transcribed it here:

                Y.                      _   
                YiL                   .```.  
                Yii;                .; .;;`.    
                YY;ii._           .;`.;;;; :    
 iiYYYYYYiiiii;;;;i` ;;::;;;; 

On the Viability of Erlang Releases and CouchDB

There has been some discussion on what versions of Erlang CouchDB should support, and what versions of Erlang are detrimental to use. Sadly there were some pretty substantial problems in the R15 line and even parts of R16 that are landmines for CouchDB. This post will describe the current state of things and make some potential recommendations on approach.

Scheduler Collapse