Skip to content

Instantly share code, notes, and snippets.

View TWolverson's full-sized avatar
🏠
Working from home

TWolverson

🏠
Working from home
View GitHub Profile
public class Window {
public Window() {
_member = ServiceLocator.GetInstance<IMember>();
}
}
class Program
{
static void Main(string[] args)
{
}
private IEnumerable<dynamic> Parse()
{
for (int i = 0; i < 10; i++)
{
type node =
| A
| B
| Empty
| NotANode
let delta centre satellite =
// where delta and centre are identical, +1
// where delta and centre are A/B or B/A, -1
// any other combination, 0
var sample = random.NextDouble(1);
var cumulative = 0.0;
var selectedItem = items.TakeWhile(item => {
cumulative += item.Probability; // probability is a ratio i.e. fraction of 1
return cumulative <= sample;
}).Last();
keydown keyCode=16 which=16 charCode=0
keydown keyCode=192 which=192 charCode=0
keypress keyCode=64 (@) which=64 (@) charCode=64 (@)
keyup keyCode=192 which=192 charCode=0
keyup keyCode=16 which=16 charCode=0
keydown keyCode=16 which=16 charCode=0
keydown keyCode=222 which=222 charCode=0
keypress keyCode=126 (~) which=126 (~) charCode=126 (~)
keyup keyCode=222 which=222 charCode=0
keyup keyCode=16 which=16 charCode=0
public class ReferenceValuesService{
public ReferenceValuesService(Func<Context> contextFactory){
this.contextFactory = contextFactory;
this.referenceValues = new Lazy<IEnumerable<ReferenceValue>>(() => this.contextFactory().GetReferenceValues());
}
public IEnumerable<ReferenceValue> ReferenceValues(){
return this.referenceValues.Value;
}
@TWolverson
TWolverson / gist:a0446603654abaeb4114
Last active August 29, 2015 14:13
Micro ORM as single method
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace MCVE
{
class Program
{
static void Main(string[] args)