This file contains hidden or 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 CheapProcess = | |
open System.Diagnostics | |
type Agent<'T> = MailboxProcessor<'T> | |
type Answer = | |
Ok | |
let rec start howMany (pid: Agent<Answer>) = | |
Agent.Start(fun inbox -> |
This file contains hidden or 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
-file("foo.ex", 1). | |
-module('Elixir.Foo'). | |
-export(['__info__'/1, test/0]). | |
'__info__'(functions) -> [{test, 0}]; | |
'__info__'(macros) -> []; | |
'__info__'(docs) -> [{{test, 0}, 2, def, [], nil}]; | |
'__info__'(moduledoc) -> {1, nil}; |
This file contains hidden or 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 Microsoft.AspNet.SignalR; | |
using Microsoft.AspNet.SignalR.Messaging; | |
using RabbitMQ.Client; | |
namespace SignalR.RabbitMQ { | |
public static class DependencyResolverExtensions { | |
public static IDependencyResolver UseRabbitMq(this IDependencyResolver resolver, ConnectionFactory connectionFactory) { | |
if (connectionFactory == null) { |
This file contains hidden or 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
describe('Model Sync',function(){ | |
var Test=ko.Model.extend({urlRoot:'/Foo'}); | |
describe('When fetching a model', function() { | |
var model = new Test({id:1}), | |
parseSpy = sinon.spy(model,"parse"); | |
sinon.stub(jQuery, "ajax") | |
.returns(jQuery.when({foo:"bar"})); | |
This file contains hidden or 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
let luhn chars = | |
let rec luhn even sum digits = | |
match digits, even with | |
| [], _ -> sum % 10 = 0 | |
| head :: tail, false when head > 4 -> luhn true (sum + head*2-9) tail | |
| head :: tail, false -> luhn true (sum + head*2) tail | |
| head :: tail, true -> luhn false (sum + head) tail | |
chars | |
|> List.rev | |
|> List.map(fun (c:char) -> int c - int '0') |
This file contains hidden or 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
let histogram (str:string)= | |
str.ToCharArray() | |
|> Seq.map(fun x-> Char.ToLower(x)) | |
|> Seq.filter(fun x-> vowels.IndexOf(x)>=0) | |
|> Seq.countBy(fun x-> x) |