Skip to content

Instantly share code, notes, and snippets.

View PureKrome's full-sized avatar
💭
🦘🕺🏻🎶🕹

Justin Adler PureKrome

💭
🦘🕺🏻🎶🕹
View GitHub Profile
@davidfowl
davidfowl / MinimalAPIs.md
Last active May 18, 2024 18:28
Minimal APIs at a glance
@sixeyed
sixeyed / profile.ps1
Created November 1, 2018 11:25
PowerShell profile with a Linux-style prompt and aliases for common Docker commands
function Prompt(){
$W = Split-Path -leaf -path (Get-Location)
$prompt = Write-Prompt "$($env:UserName)@$($env:ComputerName):" -ForegroundColor Green
$prompt += Write-Prompt $W -ForegroundColor DarkCyan
$prompt += Write-Prompt '>'
return ' '
}
function Remove-StoppedContainers {
docker container rm $(docker container ls -q)
@frankradocaj
frankradocaj / DeltaHelper.cs
Created April 13, 2018 04:07
A helper to resolve the list of differences (delta) between two lists
public static class DeltaHelper
{
public static (IEnumerable<TItem> Left, IEnumerable<TItem> Both, IEnumerable<TItem> Right) Compute<TItem, TValue>(
IEnumerable<TItem> list1,
IEnumerable<TItem> list2,
Func<TItem, TValue> getItemValue)
where TValue : IEquatable<TValue>
{
var comparableList1 = list1.Select(x => new EqualityComparer<TItem, TValue>
{
@a3dho3yn
a3dho3yn / mongodb_c#_cheatsheet.md
Last active March 27, 2024 00:04
MongoDB C# Driver Cheat Sheet

MongoDB C# Driver Cheat Sheet

(C) 2015 by Derek Hunziker, (C) 2017 by AppsOn

As of releasing MongoDB 3.4 and C# Driver v2.4, original cheatsheet by Derek is outdated. In addition, it has some deficiencies like connecting to MongoDB, creating indexes, etc. This updated version works fine with C# Driver v2.4.7 and MongoDB v3.4.

Setup

Define Document Models

Note: Defined models and collections will be used in entire cheatsheet.

@davidfowl
davidfowl / Example1.cs
Last active March 28, 2024 20:36
How .NET Standard relates to .NET Platforms
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
@NickCraver
NickCraver / BotLovin.cs
Last active January 5, 2023 11:36
Some bot/crawler fun on Stack Overflow. 10 hours of fun, to be precise.
private static readonly string[] tenHoursOfFun =
{
"https://www.youtube.com/watch?v=wbby9coDRCk",
"https://www.youtube.com/watch?v=nb2evY0kmpQ",
"https://www.youtube.com/watch?v=eh7lp9umG2I",
"https://www.youtube.com/watch?v=z9Uz1icjwrM",
"https://www.youtube.com/watch?v=Sagg08DrO5U",
"https://www.youtube.com/watch?v=5XmjJvJTyx0",
"https://www.youtube.com/watch?v=IkdmOVejUlI",
"https://www.youtube.com/watch?v=jScuYd3_xdQ",
@thefringeninja
thefringeninja / Dude.cs
Created February 3, 2015 22:47
Raven Async and Tests
public class RavenTestBase {
Task<IDocumentStore> _createDocumentStore;
ctor() {
var source = new TaskCompletionSource<IDocumentStore>();
_createDocumentStore = source.Task;
Task.Run(async () => {
var store = InitializeDocumentStore();
@PureKrome
PureKrome / NuGetPackageAndPublish.ps1
Last active September 1, 2023 09:33
Powershell NuGet publish script
############################################################################
### ###
### NUGET PACKAGE and PUBLISH ###
### ###
############################################################################
param (
@davidfowl
davidfowl / dotnetlayout.md
Last active May 30, 2024 13:19
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
@davidfowl
davidfowl / gist:4559450
Created January 17, 2013 20:29
Generate urls properly on appharbor.
<appSettings>
<add key="aspnet:UseHostHeaderForRequestUrl" value="true"/>
</appSettings>