Skip to content

Instantly share code, notes, and snippets.

liammclennan / gist:aa1b3a5e74eb3ff01898
Last active Aug 29, 2015
Pitch frequency code puzzle
View gist:aa1b3a5e74eb3ff01898
Write a function that calculates the number of semitones between two musical notes.
The notes are [A;ASharp;B;C;CSharp;D;DSharp;E;F;FSharp;G;GSharp].
The distance between each is 1 semitone. E.g. ASharp -> E = 6 semitones.
Twist: The notes can be in 3 different octaves. E.g. ASharp (octave 1) -> E (octave 2) = 18 semitones.
Extra credit: If A (octave 1) is 220Hz write a function that calculates the frequency of a note in an octave.
E.g. Frequency(A, 1) == 220, Frequency(A,2) == 440 etc
liammclennan / gist:542cb1264305f525c70b
Created May 27, 2015
Partitioning events with (linqpad - reference and Rx-main)
View gist:542cb1264305f525c70b
void Main()
var system = ActorSystem.Create("MySystem");
var greeters = system.ActorOf(Props.Create(() => new DeviceSplitter()));
var r = new System.Random();
var measures = Enumerable.Repeat(new [] {"a","b","c","d"}, 250000)
.SelectMany(c => c)
.Select (id => new Measure(id,r.Next()));
foreach (var m in measures) greeters.Tell(m);
View gist:11033b3c5a19f2b1e14c

A simple format for a scoping workshop

  1. Summarize goal / purpose of product. What is the vision? What is the anticipated value? (reduced cost, increased revenue, social benefit)

  2. What is the expected lifecycle of the product?

  3. Identify stakeholders / categories of users

  4. Map process (current state or desired)



Many people use Redis for a simple message broker. RedisMQ is a trivial layer on Redis and StackExchange.Redis that probably does not work. It provides two simple messaging patterns:

Publish / subscribe

A publisher publishes messages. 0, 1 or more consumers subscribe to the messages.

liammclennan / gist:c8c23313da3da1ab9e4e
Created Apr 28, 2015
Observable Stream Processing
View gist:c8c23313da3da1ab9e4e
void Main()
Topology.Run(new RxDelta(),
liammclennan / result.txt
Created Apr 28, 2015
Stream processing via redis
View result.txt
void Main()
var sub = Topology.Run(""/* redis address*/, new Action<StreamSource,StreamSink> [] {
Topology.SplitToWords, Topology.WordCounter
var data = new List<string> {
"You can also send events to an Event Hub asynchronously. Sending asynchronously can increase the rate at which a client is able to send events. Both the Send and SendBatch methods are available in asynchronous versions that return a Task object. While this technique can increase throughput, it can also cause the client to continue to send events even while it is being throttled by the Event Hubs service and can result in the client experiencing failures or lost messages if not properly implemented. In addition, you can use the RetryPolicy property on the client to control client retry options.",
"Although it is most common to send events to an Event Hub with a partition key, in some cases you might want to send events directly to a given partition. For example",
"Event Hubs has two primary models for event co
View gist:160dc400a2a9629a2f5a
type Direction = N | E | S | W
type Rover = {x:int;y:int;direction:Direction}
type Action = L | R | M
type Instruction = {rover:Rover; actions:Action list}
type Initialization = { upperRightX: int; upperRightY: int; instructions: Instruction list}
let testInput = "5 5
1 2 N
3 3 E
View gist:50d58f366b99f38f5926
title: 'Home',
entry: function () {
return server.getDecks().then(function (decks) {
var data = {decks: decks};
return [components.Home(data), data];
}, function () {
return [components.NotAuthenticated(), {}];
liammclennan / gist:8c642478f6e39c1303d2
Created Feb 12, 2015
Mapping serialized tuples (F#) to JavaScript objects
View gist:8c642478f6e39c1303d2
// response from server
// "[{"item1":{"id":"ce957038-fed0-4c09-8594-5475efcac4d3","name":""},"item2":3}, ...]"
doSomethingAjaxing().then(mapSerializedTuples.bind(null, ['deck', 'count']));
// after mapping
// "[{"deck":{"id":"ce957038-fed0-4c09-8594-5475efcac4d3","name":""},"count":3}, ...]"
function mapSerializedTuple(keyNames) {
return function (tuple) {

#What is even Developer?#

#What skills differntiate me from the unwashed masses?#

  • Enthusiastic
  • Hunger for knowledge and learnings
  • I can right unit tests alright
  • I'm a team player