Skip to content

Instantly share code, notes, and snippets.

@dstj
dstj / compareResharperJsonTests.ahk
Last active December 21, 2015 18:19
This AutoHotKey script facilitates comparing Resharper tests results where one-liner JSON are compared by copy-pasting them, formatting them and comparing them in Notepad++ with the Compare plugin.
; Copy Paste Resharper tests one-liner JSON exptected vs actual output and compare them in Notepad++
; Use by first copying ALL test output in the clipboard, and then press CTRL-ALT-WIN-C
^#!c::
; Start Notepad++
ProgramFilesX86 := A_ProgramFiles . (A_PtrSize=8 ? " (x86)" : "")
Run %ProgramFilesX86%\Notepad++\notepad++.exe -multiInst -nosession
WinWaitActive, new 1 - Notepad++, , 1
Send ^!d
Sleep, 100
; Paste in new document
@dstj
dstj / MimeTypeMapper.cs
Last active May 18, 2019 15:43
C# Forward and Reverse Mapping of common MimeType
public static class MimeTypeMapper
{
// ref. http://stackoverflow.com/a/3393525/918244
// modified by Dominic St-Jacques to add a reverse lookup
private static readonly IDictionary<string, string> ExtToMimeMappings;
private static readonly IDictionary<string, string> MimeToExtMappings;
private const string DefaultMimeType = "application/octet-stream";
static MimeType()
{
@dstj
dstj / ag-standard-header.component.ts
Created February 10, 2022 16:40
A custom Angular (v12) component to mimic the Ag-Grid's (v27.0.0) regular, standard column header. This serves as a basis for a custom header development
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, OnDestroy, ViewChild } from '@angular/core';
import { IHeaderAngularComp } from 'ag-grid-angular';
import { IHeaderParams } from 'ag-grid-community';
@Component({
selector: 'ag-standard-header',
template: `
<div class="ag-cell-label-container" role="presentation" [ngClass]="{'ag-header-cell-sorted-asc': params.column.isSortAscending(), 'ag-header-cell-sorted-desc': params.column.isSortDescending(), 'ag-header-cell-sorted-none': params.column.isSortNone()}">
<span *ngIf="params.enableMenu" #menuButton ref="eMenu" class="ag-header-icon ag-header-cell-menu-button" aria-hidden="true" (click)="onMenuClicked()">
<span class="ag-icon ag-icon-menu" unselectable="on" role="presentation"></span>