Skip to content

Instantly share code, notes, and snippets.


Nick Craver NickCraver

View GitHub Profile
NickCraver / OptInRelationalModelSource.cs
Last active Aug 22, 2018
OptInRelationalModelSource.cs - Making EF Core opt-in instead of opt-out for properties
View OptInRelationalModelSource.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Reflection;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Infrastructure.Internal;
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
using Microsoft.EntityFrameworkCore.Metadata.Conventions.Internal;

Keybase proof

I hereby claim:

  • I am nickcraver on github.
  • I am nickcraver ( on keybase.
  • I have a public key ASAVMojHFRx86OeapA0fAbGblg0VzqFn4agNkah58X9ixQo

To claim this, I am signing this object:

NickCraver / DelayTest.cs
Created Jul 22, 2018
A simple program showing Task.Delay(1) and what really happens
View DelayTest.cs
async Task Main()
for (var i = 0; i < 20; i++)
await Run(); // Just to show it many times
public async Task Run()
NickCraver / Craver-Paradox.ps1
Last active Jun 15, 2021
My PowerShell PoshGit theme (used with Cmder)
View Craver-Paradox.ps1
#requires -Version 2 -Modules posh-git
# This is a tweaked version of
function Write-Theme {
NickCraver / MiniProfiler ReadMe.cs
Last active Sep 25, 2020
MiniProfiler README Table Generator
View MiniProfiler ReadMe.cs
var packages = new[] {
NickCraver / notblue.css
Last active Oct 6, 2018
TweetDeck Dark Theme - Revert the Blue
View notblue.css
html.dark .column, html.dark .stream-item {
background-color: #222426;
html.dark .detail-view-inline-text {
background: #fff;
color: #8899a6;
html.dark a, html.dark a:hover,
html.dark .other-replies-link, html.dark .other-replies-link:hover,
html.dark .btn-neutral-positive, html.dark .btn-neutral-positive:hover, html.dark .btn-neutral-positive:focus {
NickCraver / Http.cs
Last active Jan 17, 2020
HttpClient Ideas
View Http.cs
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
NickCraver / .editorconfig
Created Sep 26, 2017
Stack Overflow's .editorconfig
View .editorconfig
root = true
# Don't use tabs for indentation.
indent_style = space
charset = utf-8
end_of_line = lf
NickCraver / Stylus.StackExchange.css
Created Jul 7, 2017
My Stylus theme for Stack Exchange MiniProfiler and Chat
View Stylus.StackExchange.css
@-moz-document domain(""), domain(""), domain(""), domain(""), domain(""), domain("") {
.profiler-result tr[style*='display: block;'] {
display: table-row !important;
.profiler-result th[style*='display: block;'], .profiler-result td[style*='display: block;'] {
display: table-cell!important;
@-moz-document domain(""), domain(""), domain("") {
NickCraver / Query.sql
Created Jun 1, 2017
SQL Divide By Zero Glitch with aggregates
View Query.sql
SELECT [tag.iface], [], Sum([value]) [value], [timestamp]
FROM (SELECT [tag.iface], [], [tag.direction], [dateDiff], Max([value]) [value],
DateAdd(Second, DateDiff(Second, GETUTCDATE(), [timestamp]) / 15 * 15, GETUTCDATE()) [timestamp]
FROM (SELECT [tag.iface],
DateDiff(Second, [LastTime], [timestamp]) [dateDiff],
--(([value] - [LastValue]) / NullIf(DateDiff(Second, [LastTime], [timestamp]), 0)) [value]
(([value] - [LastValue]) / DateDiff(Second, [LastTime], [timestamp])) [value]