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 ObjectToDictionaryHelper | |
{ | |
public static IDictionary<string, object> ToDictionary(this object source) | |
{ | |
return source.ToDictionary<object>(); | |
} | |
public static IDictionary<string, T> ToDictionary<T>(this object source) | |
{ | |
if (source == 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
// See: http://stackoverflow.com/questions/3441916/automapper-mapping-issue-with-inheritance-and-abstract-base-class-on-collection/5749579#5749579 | |
// | |
// For use with AutoMapper | |
public class ProxyConverter<TSource, TDestination> : ITypeConverter<TSource, TDestination> | |
where TSource : class | |
where TDestination : class | |
{ | |
public TDestination Convert(ResolutionContext context) | |
{ | |
// Get dynamic proxy base type |
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.Web; | |
namespace NetflixDemo | |
{ | |
public class AppHarborHttpContextWrapper : HttpContextWrapper | |
{ | |
private readonly HttpContext httpContext; | |
public AppHarborHttpContextWrapper(HttpContext httpContext) : base(httpContext) | |
{ |
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
body { | |
font-family: Helvetica, arial, sans-serif; | |
font-size: 14px; | |
line-height: 1.6; | |
padding-top: 10px; | |
padding-bottom: 10px; | |
background-color: white; | |
padding: 30px; } | |
body > *:first-child { |
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
//------------------------------------------------------------- | |
// | |
// Hypothesis: | |
// | |
// Promises/A is a Monad | |
// | |
// To be a Monad, it must provide at least: | |
// - A unit (aka return or mreturn) operation that creates a corresponding | |
// monadic value from a non-monadic value. | |
// - A bind operation that applies a function to a monadic value |
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
#!/usr/bin/python | |
import os | |
import sys | |
import argparse | |
import iso8601 | |
import re | |
import subprocess | |
import logging | |
import json |
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
/* | |
* Observable | |
*/ | |
var xs = Rx.Observable.range(0, 3) | |
xs.subscribe(log) | |
//=> 0 | |
//=> 1 | |
//=> 2 |
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; | |
namespace Memoization | |
{ | |
public static class Memoize | |
{ | |
#region Create memoization containers | |
public interface IContainerFactory |
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
import {Component} from 'angular2/core'; | |
import {MutliSelectDropdownComponent, DropdownItem, DropdownSelectionItem} from './multiselect.component'; | |
/* | |
* Example usage of a simple multi select dropdown for angular 2. | |
* See component for more information. | |
*/ | |
@Component({ | |
selector: 'my-app', | |
directives: [MutliSelectDropdownComponent], |
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 HomeController : Controller { | |
private readonly ViewRender view; | |
public HomeController (ViewRender view) { | |
this.view = view | |
} | |
public string Test () { | |
// render ~/Views/Emails/ResetCode |
OlderNewer