Skip to content

Instantly share code, notes, and snippets.

View angularsen's full-sized avatar

Andreas Gullberg Larsen angularsen

View GitHub Profile
@angularsen
angularsen / NamespaceGuid.cs
Created November 24, 2020 08:56
NamespaceGuid
// Original source: https://github.com/Faithlife/FaithlifeUtility/blob/master/src/Faithlife.Utility/GuidUtility.cs
using System;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace Faithlife.Utility
{
/// <summary>
@angularsen
angularsen / AsmdefDebug.cs
Last active November 16, 2023 13:24 — forked from karljj1/Unity Assembly Definition Debugger.cs
Find out what assemblies are being built and how long each takes. Updated to only build for Editor, and to include total time in first line of log output.
#if UNITY_EDITOR
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using UnityEditor;
using UnityEditor.Compilation;
using UnityEngine;
/// <summary>
@angularsen
angularsen / IPAddressExtensions.cs
Last active November 13, 2023 11:44
IsPrivate extension method for IPAddress
using System;
using System.Net;
using System.Net.Sockets;
namespace MyNamespace
{
/// <summary>
/// Extension methods on <see cref="System.Net.IPAddress"/>.
/// </summary>
public static class IPAddressExtensions
@angularsen
angularsen / MarginSetter.cs
Created January 17, 2015 12:19
WPF - Automatic horizontal or vertical spacing in StackPanel and other list like panels
using System.Windows;
using System.Windows.Controls;
using JetBrains.Annotations;
namespace Foo
{
public class MarginSetter
{
private static Thickness GetLastItemMargin(Panel obj)
{
@angularsen
angularsen / SimpleRequestTelemetryNameActionFilter.cs
Created November 20, 2021 19:11
Simple request telemetry names
#nullable enable
using System;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Digma.Api.Common.Telemetry
{
/// <summary>
/// Action filter to construct a simpler telemetry name from the route name or the route template.
@angularsen
angularsen / TypeMemberLayout.xaml
Last active December 9, 2021 08:46 — forked from collinbarrett/TypeMemberLayout.xaml
Rider/ReSharper File Layout for StyleCop.Analyzers with alphabetical order
<?xml version="1.0" encoding="utf-16"?>
<!--
Inspired by: https://collinmbarrett.com/stylecop-ordering-resharper/
Source: https://gist.github.com/angularsen/98bfab4d5e887ab37143214fad1fadbd
Modifications:
- Sort by Name after all other sorting criteria
-->
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
<TypePattern DisplayName="StyleCop Classes, Interfaces, &amp; Structs" RemoveRegions="All">
<TypePattern.Match>
### Keybase proof
I hereby claim:
* I am angularsen on github.
* I am angularsen (https://keybase.io/angularsen) on keybase.
* I have a public key ASBk63TsyBng27LKfVncxiMbyB326LmFLu2_IjffuoOFDAo
To claim this, I am signing this object:
@angularsen
angularsen / .gitattributes
Last active January 6, 2020 12:31
Git dotfiles for Unity 3D
# Disable EOL conversions by default
* -text
## Unity ##
*.cs diff=csharp text
*.cginc text
*.shader text
*.mat merge=unityyamlmerge
@angularsen
angularsen / Application_Start.cs
Last active November 5, 2019 09:08
CreateOrMigrateDatabase()
// Call me on startup, such as in Application_Start() of Global.asax.cs
private static void CreateOrMigrateDatabase()
{
// Disable automatic migrations as it prevents us from deploying DB changes without breaking the production web instance.
Database.SetInitializer<ApplicationDbContext>(null);
var migrator = new DbMigrator(new Configuration());
// Order by migration names to get oldest first, such as 201403221133523_AddSetting
List<string> pendingMigrations = migrator.GetPendingMigrations().OrderBy(x => x).ToList();
@angularsen
angularsen / dev_tips.md
Last active April 10, 2019 07:32
A neverending gist about developer tips, because blogs are lame

Browsers

Network: Show only page navigations including redirects

Using the Doc filter in Chrome seems to merge entries during redirects, losing info. Instead, use the Filter input.

  • Chrome: mime-type: text/html
  • FireFox: cause: document