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 WebApiApplication : System.Web.HttpApplication | |
{ | |
protected void Application_Start() | |
{ | |
//... | |
GlobalConfiguration.Configuration.MessageHandlers.Add(new TaskCanceledExceptionHandler()); | |
} | |
} |
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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
using (var bus = RabbitHutch.CreateBus("host=localhost")) | |
{ | |
var subscriber = new AutoSubscriber(bus, "Subscriber"); | |
subscriber.SubscribeAsync(Assembly.GetExecutingAssembly()); | |
Console.WriteLine("Listening for messages. Hit <return> to quit."); | |
Console.ReadLine(); |
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 ImageProcessRequestConsumer : IConsumeAsync<ImageProcessRequest> | |
{ | |
Command command = new Command("connectionString"); | |
public async Task Consume(ImageProcessRequest message) | |
{ | |
await command.ExecuteScalarAsync( | |
@"Insert into Images(TrackingNumber, Format, Image) | |
Values(@TrackingNumber, @Format, @Image)", | |
message); |
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 static class RabbitMQ | |
{ | |
public static IBus Bus { get; private set; } | |
static RabbitMQ() | |
{ | |
Bus = RabbitHutch.CreateBus("host=localhost"); | |
} | |
} |
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 TemporaryDirectory : IDisposable | |
{ | |
readonly string _directory; | |
public TemporaryDirectory() | |
{ | |
_directory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); | |
Directory.CreateDirectory(_directory); | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> | |
<title>Animated Hierarchy</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> | |
</head> |
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 enum Atom | |
{ | |
OK, Unauthorized, NotFound, Forbidden | |
} |
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
[alias] | |
cm = !git add -A && git commit -m | |
co = checkout | |
cob = "!f() { git checkout ${2-develop} && git up && git checkout -b ${1}; }; f" | |
ec = config --global -e | |
undo = reset HEAD~1 --mixed | |
up = pull --rebase --prune | |
wipe = !git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 --hard |
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
var Ar = { | |
filter: function(fn, list) { | |
if (!list[0]) return []; | |
if (fn(list[0])) return [list[0]].concat(Ar.filter(fn, list.slice(1))); | |
return [].concat(Ar.filter(fn, list.slice(1))); | |
}, | |
first: function(fn, list) { | |
if (!list[0]) return null; | |
if (fn(list[0])) return list[0]; | |
return Ar.first(fn, list.slice(1)); |
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
System.IO.Directory.SetCurrentDirectory (__SOURCE_DIRECTORY__) | |
#r "Microsoft.Office.Interop.Excel" | |
#r "office" | |
open System | |
open Microsoft.Office.Interop.Excel | |
let xlApp = new ApplicationClass() | |
let workbook = xlApp.Workbooks.Open(@"C:\Dev\ExcelRedirects\ExcelRedirects\redirects.xls") | |
let sheet = workbook.Worksheets.[1] :?> Worksheet |