A very simple example of using a map of channels for pub/sub in go.
To run it go here http://play.golang.org/p/eXwppMgHR3
| module Main where | |
| import Data.List | |
| data Coder = Coder String | |
| | Nobody | |
| deriving (Show) | |
| data Pairings = Pair Coder Coder | |
| | Pairs [Pairings] |
| require 'pp' | |
| devs = %w{ Andrew Anthony Ben Matt Tom Zac } | |
| devs << nil if devs.length.odd? | |
| top, bottom = devs.each_slice(devs.length/2).to_a | |
| pivot, *top = top | |
| result = [] | |
| (devs.length-1).times do | |
| top.unshift(bottom.shift) |
| * My solution | |
| MAIN ENT1 0 | |
| ENT2 3999 | |
| ENTA 133 | |
| STA 0,2 | |
| DEC2 1 | |
| CMP2 7(4:5) | |
| JGE 3 | |
| MOVE 9(9) | |
| CON 9 |
| #!/bin/sh | |
| if test -n "$1"; then | |
| ref="$1" | |
| else | |
| ref="HEAD" | |
| fi | |
| git diff $ref --not master --name-only -- db/migrate/ | | |
| cut -d/ -f3 | |
| Context | |
| The circumstances that form the setting for an event, statement, or | |
| idea, and in terms of which it can be fully understood and assessed. | |
| When you are writing a commit message getting the context right is very | |
| important. Here are some pieces of information that are useful for | |
| building up a proper context. | |
| * Explain what was done. |
| diff --git a/builtin/fetch.c b/builtin/fetch.c | |
| index 5647055..b67a350 100644 | |
| --- a/builtin/fetch.c | |
| +++ b/builtin/fetch.c | |
| @@ -810,11 +810,6 @@ static int do_fetch(struct transport *transport, | |
| if (tags == TAGS_DEFAULT && autotags) | |
| transport_set_option(transport, TRANS_OPT_FOLLOWTAGS, "1"); | |
| - if (fetch_refs(transport, ref_map)) { | |
| - free_refs(ref_map); |
| class Tokenizer | |
| class Buffer # :nodoc: | |
| def initialize io | |
| @io = io | |
| @buffer = [] | |
| end | |
| def peek len = 1 | |
| (len - @buffer.length).times { |
| require File.dirname(__FILE__) + '/../test_helper' | |
| class RangeTest < Test::Unit::TestCase | |
| test <<-TEST do | |
| Range#coinsides_with? | |
| | | |
| | | |
| TEST | |
| range = Time.zone.now..Time.zone.now |
| require 'action_mailer' | |
| require 'mail' | |
| module ActionMailer | |
| class TestCase | |
| def set_expected_mail | |
| @expected = Mail.new | |
| @expected.content_type = "text/plain; charset=#{charset}" | |
| @expected.mime_version = '1.0' |
A very simple example of using a map of channels for pub/sub in go.
To run it go here http://play.golang.org/p/eXwppMgHR3