Skip to content

Instantly share code, notes, and snippets.

View khellang's full-sized avatar

Kristian Hellang khellang

View GitHub Profile
public class AnimalFactory
{
public IEnumerable<IAnimal> GetAnimals()
{
yield return new Dog();
var ducks = GetDucks();
// return ducks; <-- **BOOM** Cannot return a value from an iterator.
public interface IEmailSender
{
void Send(string recipient, string subject, string htmlBody);
}
public class EmailSender : IEmailSender
{
private readonly IEmailSettings _settings;
public EmailSender(IEmailSettings settings)
using Microsoft.AspNet.Builder;
namespace KWebStartup
{
public class Startup
{
public void Configure(IBuilder app)
{
// Doesn't require a dependency on anything.
// It's just an extension method on Func<AppFunc, AppFunc>.
# Utilities
cinst 7zip
cinst ConEmu
# Fonts
cinst SourceCodePro
# Coding
cinst git
cinst P4Merge
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Lenovo\SmartKey\Application\Row\Function\Microsoft Visual Studio 2013]
"AppPath"="C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\devenv.exe"
public static MidFunc Tracing(ITracer tracer)
{
if (tracer == null) throw new ArgumentNullException("tracer");
tracer = new SafeTracer(tracer);
return next => async env =>
{
if (!tracer.IsEnabled)
{
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();

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.

@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"
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