Skip to content

Instantly share code, notes, and snippets.

-module(rebar_yang).
-compile(export_all).
%% Add to rebar.config
%% {plugins, [rebar_yang]}.
pre_compile(_Config,AppFile) ->
rebar_log:log(info, "rebar_yang: ~p~n", [rebar_utils:get_cwd()]),
scan_files(rebar_utils:get_cwd()),
ok.
//-*- Javascript -*-
'use strict';
angular.module('xray')
.service('xray:tposs:test', function MockCdrList() {
var fields = [
{
"fieldName": "LocationId",
"type": "string",
"description": "Location object identifier.",

Basic Guidelines (Mostly for Erlang)

Our ideal code is short, easy to read, has good tests and no compile warnings. New code should be written to conform to those standards, but existing code may not already meet that standard. In that case we should aim to improve that code over time.

Keep the Code Short

A function should do one thing, if a function clause is more than 5

Some Notes on building packages

Build must be simple

A developer must be able to make a build in one step. Ideally he should be able to type build <> <> and have a build happen with no further intervention. By making the developer only type one command we greatly reduce the chance that a step will be forgotten, done out order or otherwise messed up.

@zkessin
zkessin / .travis.yml
Created May 15, 2014 13:59
.travis.yml for using QuickCheck
language: erlang
notifications:
disabled: true
install:
- wget http://www.quviq.com/downloads/eqcmini.zip
- unzip eqcmini.zip
- export ERL_LIBS=eqcmini
script:
@zkessin
zkessin / poset.pl
Last active August 29, 2015 14:02
Code for partially ordered sets in prolog
connected(A,B) :-
edge(A,B).
sib(A,B) :-
path(C,A,_),
path(C,B,_),
\+path(A,B,_),
\+path(B,A,_).
ancestor(A,B) :-
prop_render() ->
{ok, online_users_dtl} = erlydtl:compile_file("templates/online_users.dtl", online_users_dtl, []),
?FORALL(Rs,
list(presence()),
begin
{ok,HTML} = vest_current_users:render(Rs),
mochiweb_html:parse(iolist_to_binary(HTML)), %% assert that it is valid HTML
[_Prefix,Rows,_Suffix] = HTML,
length(Rows) =:= length(Rs)
end).
-module(erl_cache_tests).
-include_lib("proper/include/proper.hrl").
-include_lib("eunit/include/eunit.hrl").
-compile(export_all).
keys() ->
[
"AAAAAAAA",
"8BFE5E9B",
"59665E9E",
@zkessin
zkessin / split.pl
Last active August 29, 2015 14:04
%-*- Prolog -*-
split(Head, Tail, HeadLength, FullList) :-
length(Head, HeadLength),
append(Head, Tail, FullList).
?- split(H,T, 3, [a,b,c,d,e,f,g,h,i,j,k,l]).
H = [a, b, c],
T = [d, e, f, g, h, i, j, k, l].
-module(json_test).
-include_lib("eqc/include/eqc.hrl").
-include_lib("eunit/include/eunit.hrl").
-compile(export_all).
-include("erlog_test.hrl").
json_test() ->
{ok, ERLOG_STATE} = erlog:new(),
Data = [{<<"test">>, 12345}],
?assertMatch({{succeed,_},_}, erlog:prove(ERLOG_STATE, {length, Data, {'Len'}})).