Skip to content

Instantly share code, notes, and snippets.

View drmohundro's full-sized avatar
:shipit:

David Mohundro drmohundro

:shipit:
View GitHub Profile
@davidfowl
davidfowl / .NET6Migration.md
Last active February 29, 2024 19:00
.NET 6 ASP.NET Core Migration
@ErikEJ
ErikEJ / IQueryableExtensions.cs
Last active February 29, 2024 12:16
Replacement for EF Core .Contains, that avoids SQL Server plan cache pollution
using System.Linq.Expressions;
namespace Microsoft.EntityFrameworkCore
{
public static class IQueryableExtensions
{
public static IQueryable<TQuery> In<TKey, TQuery>(
this IQueryable<TQuery> queryable,
IEnumerable<TKey> values,
Expression<Func<TQuery, TKey>> keySelector)
@Jaykul
Jaykul / Convert-Path.ps1
Last active January 25, 2021 08:09
The Path commands for Convert and Resolve don't have -Force and don't fix case
function Convert-Path {
<#
.SYNOPSIS
A replacement for convert-path that returns a normalized form of paths, even on Windows file system.
.DESCRIPTION
This replacement for Convert-Path ensures it's returning the actual case for PowerShell paths, and normalizes them so that folders always include a trailing slash, allowing comparisons of paths to do so correctly.
When working with environment variables and paths, we want to remove duplicates,
but uniqueness tests are case-sensitive,
while the Windows FileSystem (and thus, the built-in Convert-Path) is not.
@NickCraver
NickCraver / DmpAnalysis.linq
Last active March 17, 2024 16:32
DMP Analysis in LinqPad
<Query Kind="Program">
<NuGetReference Prerelease="true">Microsoft.Diagnostics.Runtime</NuGetReference>
<Namespace>Microsoft.Diagnostics.Runtime</Namespace>
<Namespace>System</Namespace>
<Namespace>System.IO</Namespace>
<Namespace>System.Linq</Namespace>
<Namespace>System.Text</Namespace>
<Namespace>Microsoft.Diagnostics.Runtime.Utilities</Namespace>
</Query>
@bobbygrace
bobbygrace / trello-css-guide.md
Last active February 13, 2024 14:31
Trello CSS Guide

Hello, visitors! If you want an updated version of this styleguide in repo form with tons of real-life examples… check out Trellisheets! https://github.com/trello/trellisheets


Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

@akisute
akisute / APIClient.swift
Last active October 6, 2015 17:53
Example of APIClient and TestCase in Swift, using AFNetworking/Bolts
import UIKit
// How to make singleton classes in Swift: http://stackoverflow.com/questions/24024549/dispatch-once-singleton-model-in-swift
// Basically using global constants is the most easy and safe way to go
class APIClient: NSObject {
let functionSessionManager:AFHTTPSessionManager
class var sharedInstance:APIClient {
@jboner
jboner / latency.txt
Last active March 28, 2024 03:39
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD