Instantly share code, notes, and snippets.

View FailingTest.cs
public class Test
public class Name
public string Text { get; set; }
public abstract class Widget
public abstract Name Name { get; }
View ConsistentInterval.cs
public class ConsistentInterval : IDisposable
private readonly TimeSpan delay;
private readonly CancellationToken cancellationToken;
private readonly DateTimeOffset startTime;
public ConsistentInterval(TimeSpan delay, CancellationToken cancellationToken)
this.delay = delay;
this.cancellationToken = cancellationToken;

I love this quote by Mat Marquis from TXJS 2015:

We, as an industry, have nearly decided that we are all doing a really, really good job as long as we don't count the instances where we're doing a really, really bad job.


View clitests.cs
public class CommandResolutionTests
public void should_resolve_text_to_command()
public void should_call_command_hello()
"samplecommand hello".Called<SampleCommand>()
View DumbSample.sql
begin transaction
create table DumbSample (
Expired bit default 0,
Name varchar(max)
insert into DumbSample (Expired, Name) values (0, 'Milk');
View ImplicitCausingNullRef.cs
void Main()
var order = new Order
Instructions = SpecialInstructions.LeaveAtDoor,
var thing = new Thing
Instructions = order.Instructions,
View ApiController.cs
using System.Linq;
using System.Web.Mvc;
using Construction.Core.Features.QuickSearch;
using Construction.Core;
using Construction.Core.Extensions;
using Core.Helpers;
using Newtonsoft.Json.Linq;
public class ApiController : BaseController
View screencapture.ps1
function screenshot([Drawing.Rectangle]$bounds, $path) {
$bmp = New-Object Drawing.Bitmap $bounds.width, $bounds.height
$graphics = [Drawing.Graphics]::FromImage($bmp)
$graphics.CopyFromScreen($bounds.Location, [Drawing.Point]::Empty, $bounds.size)
View find_references.sql
select as TableWithForeignKey, fk.constraint_column_id as FK_PartNo , as ForeignKeyColumn
from sys.foreign_key_columns as fk
inner join sys.tables as t on fk.parent_object_id = t.object_id
inner join sys.columns as c on fk.parent_object_id = c.object_id and fk.parent_column_id = c.column_id
where fk.referenced_object_id = (select object_id from sys.tables where name = 'tablename')
order by TableWithForeignKey, FK_PartNo