Here are links to various bits of code I’ve generated to illustrate what I feel is good usage of Ruby and Erlang.  Enjoy.

Ruby

General

Whitespace Checker

Checking in broken whitespace (trailing spaces, lack of newlines, and tabs) is the bane of version control and editors.  I have a script that I run to check this.  It’s simple, but is a good use of the Find module and processing files using regexps.  Enjoy.

  • check_ws – script used in a bigger project on GitHub

Rake

erl-skel: Rakefile build system

This is my skeleton for building and deploying Erlang projects.  Rake was the right tool for this job, and here are links to the files on GitHub.

These Rakefiles show a good mix of using file tasks, globbing for files, using regexes on paths, path handling, using the Find module, capturing the output of commands, processing that output, using return codes, using dependencies, and even using Mustache to generate some files.

Erlang

General

Project Layout

Laying out Erlang projects is hard.  Here’s my stab at it.  It currently has edoc and common_test working.  It designed to allow you to develop suites of modules (not just a single one in isolation).  The eventual plan is to support making releases from these projects (NOTE: this used to work, but needs to be redone).

escript

My skeleton Erlang project has various escripts under the script directory, that are used (or have been used) to aid my Rakefile to get at data and features buried within Erlang.

OTP

Behaviors

gen_server

  • A gen_server that manages a list, offering the values on a continuous rotation.
    • shuffler.erl – gen_server and API
    • demo_slow.erl – demo that slowly trickles values to be rotated by multiple consumers
    • demo_fast.erl – preloads a list that is rotated by multiple consumers

supervisor

None yet. :)

System

Drivers

open_port( {spawn_executable,_}, …)

Spawning and interacting with a system process.  Includes input, output, and using Erlang’s automatic line framing.

 

 

Needlessly Messianic is powered by Typo and valid XHTML and CSS.
Design by Gary H. Wilson.