Skip to content

Instantly share code, notes, and snippets.

Andy Till andytill

Block or report user

Report or block andytill

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View code review.md

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 Nov 20, 2017
unlocking-the-superpowers-of-the-erlang-vm.org
View unlocking-the-superpowers-of-the-erlang-vm.txt
* Unlocking the super-powers of the Erlang VM
Lars Hesel Christensen
VerneMQ Engineer
twitter: @larshesel
✉ lars@vernemq.com
✉ lhc@larshesel.dk
github.com/larshesel
@mrallen1
mrallen1 / discussion.md
Last active Oct 14, 2019
When does terminate/2 get called in a gen_server?
View discussion.md

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 Nov 19, 2015
IF / ELSE in erlang, via parse_transform. EVIL, DO NOT USE
View ifelse.erl
%% @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
@khandkar
khandkar / labeled_and_optional_args_in_erlang.md
Last active Aug 29, 2015
Labeled (and optional) arguments in Erlang
View labeled_and_optional_args_in_erlang.md

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 Feb 19, 2019
Erlang Project Ideas
View Erlang Project Ideas.md

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

View gist:2b3220f4bceeed6f62d0
(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
View GraphVisTester.java
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
Created May 11, 2014
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
View doge.md

no clue who made this, but i have transcribed it here:

                Y.                      _   
                YiL                   .```.  
                Yii;                .; .;;`.    
                YY;ii._           .;`.;;;; :    
                iiYYYYYYiiiii;;;;i` ;;::;;;;    
            _.;YYYYYYiiiiiiYYYii  .;;.   ;;; 
         .YYYYYYYYYYiiYYYYYYYYYYYYii;`  ;;;;    
View on_the_viability_of_erlang_releases_and_couchdb.md

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

You can’t perform that action at this time.