Skip to content

Instantly share code, notes, and snippets.

@eugeneagafonov
eugeneagafonov / Program.cs
Last active December 12, 2017 19:20
async gotchas
using System;
using System.Threading.Tasks;
public class Program
{
public static async Task Main()
{
var t1 = MethodAsync();
// await Task.Delay(/*0*/1).ConfigureAwait(false);
var t2 = MethodAsync();
@eugeneagafonov
eugeneagafonov / mono41onubuntu
Last active August 29, 2015 14:17
shell script for installing latest mono on ubuntu 14.04
#!/bin/bash
PREFIX=$@
if [ -z $PREFIX ]; then
PREFIX="/usr/local"
fi
# Ensure you have write permissions to PREFIX
sudo mkdir -p $PREFIX
sudo chown -R `whoami` $PREFIX
@eugeneagafonov
eugeneagafonov / select_tables_without_clustered_index
Created July 10, 2013 09:04
Find all tables without clustered index in SQL Azure in case of 'Tables without a clustered index are not supported in this version of SQL Server.' error
SELECT name
FROM sys.objects
WHERE type = 'U'
AND object_id NOT IN
(SELECT object_id FROM sys.indexes WHERE index_id = 1)
@eugeneagafonov
eugeneagafonov / gist:4338381
Created December 19, 2012 17:08
web config with OPTIONSVerbHandler removed for CORS with Thinktecture.IdentityModel and ASP.NET Web API to work properly
<system.webServer>
<modules runAllManagedModulesForAllRequests="false">
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV"/>
<remove name="OPTIONSVerbHandler"/>
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
@eugeneagafonov
eugeneagafonov / webapinightlyunittest.cs
Created June 6, 2012 16:05
How to run unit tests in new web api builds
// assuming we have an IoC container. Autofac example
var builder = new ContainerBuilder();
// assuming your global.asax.cs defines WebApiApplication : HttpApplication
builder.RegisterApiControllers(typeof(WebApiApplication).Assembly);
var container = builder.Build();
// getting the controller
var target = container.Resolve<MyController>();
var request = new HttpRequestMessage();
request.Properties[HttpPropertyKeys.HttpConfigurationKey] = new HttpConfiguration();