This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Given a list of phone numbers, determine if it is consistent. | |
-- In a consistent phone list no number is a prefix of another. For example: | |
-- Bob 91 12 54 26 | |
-- Alice 97 625 992 | |
-- Emergency 911 | |
-- In this case, it is not possible to call Bob because the phone exchange | |
-- would direct your call to the emergency line as soon as you dialled the | |
-- first three digits of Bob's phone number. So this list would not be consistent. | |
module PhoneList(isConsistent) where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using AggregateSource; | |
namespace TheStuff | |
{ | |
class Program | |
{ | |
static void Main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module (ring). | |
-export ([start/3, first_proc/3, first_loop/4, proc_start/3, proc_loop/2]). | |
start(MsgCount, ProcCount, Msg) -> | |
spawn(ring, first_proc, [MsgCount, ProcCount, Msg]). | |
first_proc(MsgCount, ProcCount, Msg) -> | |
io:format("First process ~w created, setting up the rest of the ring ...~n", [self()]), | |
NextPid = spawn(ring, proc_start, [self(), self(), ProcCount-1]), | |
LastPid = receive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Spinner | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.Write("Working... "); | |
int spinIndex = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Erlang R13B04 (erts-5.7.5) [smp:8:8] [rq:8] [async-threads:0] | |
Eshell V5.7.5 (abort with ^G) | |
1> cd('/blah/erlang/CQRS'). | |
C:/blah/erlang/CQRS | |
ok | |
2> ls(). | |
item.erl item.hrl | |
ok | |
3> c(item). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>navigator.getUserMedia() Demo</title> | |
</head> | |
<body> | |
<h1>See yourself?</h1> | |
If your browser supports | |
<span style="font-family:monospace;">navigator.getUserMedia()</span> | |
you should see yourself below. If you don't see yourself, try | |
downloading the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Checked blog at http://blog.markrendle.net/2011/05/23/simple-data-0-6-5/ | |
// and code at https://github.com/markrendle/Simple.Data/blob/master/Simple.Data/SimpleQuery.cs | |
int? previousPhotoId = DB.Photos.Query() | |
.Select(DB.Photos.Id) | |
.Where(DB.Photos.Published == true && DB.Photos.DatePublished < currentPhoto.DatePublished.Value) | |
.OrderByDatePublishedDescending() | |
.ToScalarOrDefault<int?>(); | |
int? nextPhotoId = DB.Photos.Query() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BrowserFixture | |
{ | |
private readonly Browser browser; | |
public BrowserFixture() | |
{ | |
var bootstrapper = | |
new FakeDefaultNancyBootstrapper(); | |
this.browser = new Browser(bootstrapper); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using System.Web | |
@using System.Web.Security | |
<style type="text/css"> | |
p,label {color:black;} | |
</style> | |
@{ | |
// just refactored things a bit | |
var flashmessage = Request["flash"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
namespace CG2.FluentContent | |
{ | |
// note that I currnelty do not have any testing libs or Nancy available | |
public class ContentProviderSpecs | |
{ | |
public void A_content_provider_should_respond_to_available_content_types() | |
{ |
NewerOlder