This file contains hidden or 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
namespace Nancy.Demo.Hosting.Self | |
{ | |
using System; | |
using System.Diagnostics; | |
using Nancy.Hosting.Self; | |
class Program | |
{ | |
static void Main() |
This file contains hidden or 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.Text; | |
namespace NodeIPC | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var input = Console.OpenStandardInput(); |
This file contains hidden or 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
static readonly string[] videoCardBlacklist = {"8086:0116"}; | |
static void DisableHwRenderingForCrapVideoCards() | |
{ | |
if (!String.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("MY_VIDEO_CARD_REALLY_WORKS"))) | |
{ | |
return; | |
} | |
int osVersion = Environment.OSVersion.Version.Major * 100 + Environment.OSVersion.Version.Minor; | |
if (osVersion < 601) |
This file contains hidden or 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
// CQS (Command-Query Separation) | |
// Bertrand Meyer devised the CQS principle | |
// It states that every method should either be a command that performs an action, or a | |
// query that returns data to the caller, but not both. In other words, asking a question | |
// should not change the answer. More formally, methods should return a value only if they | |
// are referentially transparent and hence possess no side effects. | |
// | |
// Example: | |
public class CustomerService |
This file contains hidden or 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 DefaultRouteConventions: RouteConventions | |
{ | |
public DefaultRouteConventions() | |
{ | |
MapAction("Index").ConstraintToVerb(HttpVerbs.Get); | |
MapAction("List").ToRootPlural().ConstraintToVerb(HttpVerbs.Get); | |
MapAction("Details").WithParameters( | |
new List<ActionParam>() { new ActionParam() { IsComplexType = false, Name = "id" } } |
This file contains hidden or 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
*.doc diff=astextplain | |
*.DOC diff=astextplain | |
*.docx diff=astextplain | |
*.DOCX diff=astextplain | |
*.dot diff=astextplain | |
*.DOT diff=astextplain | |
*.pdf diff=astextplain | |
*.PDF diff=astextplain | |
*.rtf diff=astextplain | |
*.RTF diff=astextplain |
This file contains hidden or 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
<!-- Tab sets have to have an id set --> | |
<div class="tabs" id="mytab1"> | |
<ul class="nav nav-tabs"> | |
<li><a href="#tab1">Tab 1</a></li> | |
<li><a href="#tab2">Tab 2</a></li> | |
</ul> | |
<div class="tab-content"> | |
<div class="tab-pane" id="tab1"> | |
Content for tab 1 | |
</div> |
This file contains hidden or 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
// TRY HARD SHIT. | |
// I did and I'm learning a lot. | |
// | |
// 2 days ago I had no idea what I was doing but I decided I was going to create | |
// a database. I figured this would be a great way to learn even more about the | |
// databases I use today. I will write better software because I will know how they are | |
// designed and the optimizations and limitations they have to work with. | |
// | |
// After two days I have: | |
// - Modelled column based data model (like Cassandra) on top of a key/value store (SQLite4 does I think). |
This file contains hidden or 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 TResult GetValueSafe<TInstance, TResult>(this TInstance instance, Func<TInstance, TResult> accessor, TResult defaultValue = default(TResult)) | |
where TInstance : class | |
{ | |
return instance != null ? accessor(instance) : defaultValue; | |
} | |
usage: | |
someNullableObject.GetValueSafe(p => p.SomeProperty) | |
or |
OlderNewer