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
let Run<'T when 'T: not struct and 'T:null and 'T:equality> (errorCallback, ct:CancellationToken, finished:ManualResetEvent) = | |
let p = QueueProvider<'T>.Create() | |
try | |
while not (ct.IsCancellationRequested) do | |
match p.Dequeue() with | |
| null -> Thread.Sleep 1000 | |
| _ as obj -> | |
try | |
write obj | |
with | ex -> |
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
//I think this is more or less how it'd work | |
public IEnumerable<T> Stuffs () { | |
bool noAck = false; | |
using (var connection = connectionFactory.CreateConnection ()) | |
using (var channel = SetupChannel (connection)) { | |
var sub = new Subscription (channel, queueName, noAck); | |
while (true) { | |
var result = sub.Next (); | |
if (result != null) { |
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
namespace BrewTelligence.Search.IndexingService | |
#light | |
open System.Threading | |
open System.Configuration | |
open RabbitMQ.Client | |
open RabbitMQ.Client.MessagePatterns | |
//TODO: single connection / channel for lifetime? |
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
let Run<'T when 'T: not struct and 'T:null and 'T:equality> (errorCallback, ct:CancellationToken, finished:ManualResetEvent) = | |
let sub = new Subscriber<'T>() | |
sub.ReceivedMessages(ct) | |
|> Seq.iter (fun msg -> | |
try | |
write msg | |
with | ex -> | |
sub.Return msg | |
errorCallback ex) | |
finished.Set() |> ignore |
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
[Test] | |
public void Limit_Collection_Contents_Criteria() { | |
var pepperoni = new Topping { Name = "pepperoni", Type = "meat" }; | |
var cheese = new Topping { Name = "mozzarella", Type = "dairy" }; | |
var cheesePizza = new Pizza() { Crust = "deep dish", Sauce = "red" } | |
.WithTopping(cheese); | |
var pepperoniPizza = new Pizza() { Crust = "deep dish", Sauce = "red" } | |
.WithTopping(cheese) |
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
--desired collation for (var)char columns: | |
DECLARE @collationName VARCHAR(30) | |
SET @collationName = 'Latin1_General_CS_AI' | |
--build tables containing drop/create index queries | |
--http://www.sqlservercentral.com/scripts/Indexing/31652/ | |
SELECT | |
REPLICATE(' ',4000) AS COLNAMES , | |
OBJECT_NAME(I.ID) AS TABLENAME, | |
I.ID AS TABLEID, |
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 RestSharp; | |
namespace GithubTicketImporter { | |
class Program { | |
static IAuthenticator authenticator = new HttpBasicAuthenticator("uname", "pwd"); | |
static string assemblaBaseUrl = "https://www.assembla.com/spaces/BrewTelligence/"; | |
static string githubBaseUrl = "https://api.github.com/"; |
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
(function () { | |
$.support.placeholder = false; | |
var test = document.createElement('input'); | |
if ('placeholder' in test) { | |
$.support.placeholder = true; | |
return function () { } | |
} else { | |
return function () { | |
$(function () { | |
var active = document.activeElement; |
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.ComponentModel.DataAnnotations; | |
namespace Project.MvvmFramework.ValidationAttributes | |
{ | |
public class NullableIntegerAttribute : ValidationAttribute | |
{ | |
private readonly int _maxDigits; | |
private readonly string _propertyName; | |
const string MessageFormat = "{0} can only contain up to {1} numeric characters."; |