Skip to content

Instantly share code, notes, and snippets.

View khellang's full-sized avatar

Kristian Hellang khellang

View GitHub Profile
public class Movie
{
[CompilerGenerated]
private readonly string <Title>k__BackingField;
[CompilerGenerated]
private readonly List<string> <Genres>k__BackingField;
public string Title
{
@khellang
khellang / project.json
Created September 16, 2014 12:06
Which would you rather write? Or read?
{
"code": "*.cs",
"exclude": "buggy/**/*.cs",
"resources": "embed/**/*.*",
"dependencies": {
"Microsoft.AspNet.ConfigurationModel": { "version": "0.1-alpha-*", "options": "private" },
"FakeToolingPackage" : {"version": "0.1", "options": "dev"},
"SomeProject": ""
},
"configurations": {
public class SelfHostRootPathProvider : IRootPathProvider
{
public string GetRootPath()
{
if (StaticConfiguration.IsRunningDebug)
{
return string.Empty; // TODO: Return source directory
}
return AppDomain.CurrentDomain.BaseDirectory;
@khellang
khellang / Program.fs
Created September 10, 2014 23:00
Parse all Vinmonopolet stores and save them to database using EF
open FSharp.Data
open System
open System.Diagnostics
open Vinmonopolet.Core
type Stores =
CsvProvider<
Sample = "stores.csv",
Separators = ";",
Encoding = "ISO8859-1",
@khellang
khellang / Game.fs
Created September 9, 2014 17:52
Tennis Kata - Implemented in F#, tests are using FsUnit with Xunit
namespace Tennis
module Game =
type State = {
a: int;
b: int;
}
let callEqualScore score =
@khellang
khellang / ReallyDisableUAC.reg
Created September 9, 2014 11:00
Disable UAC
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System]
"EnableLUA"=dword:00000000
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,00,00,3a,00,00,00,00,00
@khellang
khellang / Remove-Ask-Toolbar.reg
Created August 12, 2014 15:14
Removes the ASK.com tool from the java updater
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft]
"SPONSORS"="DISABLE"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft]
"SPONSORS"="DISABLE"

ReSharper thinks this type is unused because it isn't referenced anywhere, but it's actually being picked up by convention. There's also several other ways this class can be used.

You can read more about the OWIN Startup Class Detection here.

using AppFunc = Func<IDictionary<string, object>, Task>;
public class Startup
{
public void Configuration(IAppBuilder app)
{
app.Use(new Func<AppFunc, AppFunc>(next => async env =>
{
var stopwatch = Stopwatch.StartNew();