Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Generic;
using System.Linq;
using AggregateSource;
namespace TheStuff
{
class Program
{
static void Main()
@ToJans
ToJans / ring.erl
Created October 23, 2012 17:46 — forked from stiiifff/ring.erl
Erlang process ring (Erlang programming, Chapter 4, Ex 4.2)
-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
@ToJans
ToJans / ConsoleSpinner.cs
Created October 10, 2012 13:48 — forked from robashton/ConsoleSpinner.cs
ConsoleSpinner
using System;
namespace Spinner
{
class Program
{
static void Main(string[] args)
{
Console.Write("Working... ");
int spinIndex = 0;
@ToJans
ToJans / console.erl
Created October 2, 2012 10:14
Attempt for CQRS in erlang
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).
@ToJans
ToJans / getUserMedia.html
Created December 8, 2011 08:48 — forked from tomayac/getUserMedia.html
navigator.getUserMedia Test
<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
@ToJans
ToJans / gist:1014127
Created June 8, 2011 09:53 — forked from kristofclaes/gist:1008780
Retrieving next and previous records with Simple.Data
// 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()
public class BrowserFixture
{
private readonly Browser browser;
public BrowserFixture()
{
var bootstrapper =
new FakeDefaultNancyBootstrapper();
this.browser = new Browser(bootstrapper);
@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"];
@ToJans
ToJans / 0.Specs.cs
Created March 3, 2011 09:22 — forked from thecodejunkie/ConNegModule.cs
The current implementation is a bit ugly, but this could become an easy to use content provider for the NancyFx framework
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()
{
@ToJans
ToJans / phonenumbers.hs
Last active September 11, 2015 10:12 — forked from mathiasverraes/phonenumbers.hs
Phone Number Kata
-- 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