Skip to content

Instantly share code, notes, and snippets.

View jeroenheijmans's full-sized avatar

Jeroen Heijmans jeroenheijmans

View GitHub Profile
@jeroenheijmans
jeroenheijmans / EF_Select_N_plus_1_Repro.cs
Created June 2, 2017 08:10
EntityFramework SELECT N+1 issue
/*
* Create a new Class Library and copy/paste this file over the class1.cs file.
*
* On Package Mananager Console:
*
* @("MSTest.TestFramework","MSTest.TestAdapter","EntityFramework") | foreach { Install-Package $_ }
*
* Run `sqllocaldb c soquestion` to create the instance.
* Afterwards create database `TestDb` e.g. with SSMS on that instance.
*/
@jeroenheijmans
jeroenheijmans / trello-export-lpic-1-101-study-guide.json
Last active July 8, 2017 11:31
Trello Export for LPIC-1 101 Study Guide
{
"id": "5960b8fe99b1151dc82b6cb8",
"name": "LPIC-1 101 Study Guide",
"desc": "",
"descData": null,
"closed": false,
"idOrganization": null,
"invited": false,
"pinned": false,
"starred": false,

Keybase proof

I hereby claim:

  • I am jeroenheijmans on github.
  • I am jeroenheijmans (https://keybase.io/jeroenheijmans) on keybase.
  • I have a public key ASAzXzBDLZAU_aCj3dB_dN4cDqCTyka3DSPFCMK-0hMBxwo

To claim this, I am signing this object:

@jeroenheijmans
jeroenheijmans / AspNetIdentity-SQL-Scripts.sql
Created January 17, 2018 22:33
SQL DDL scripts for [IdentityServer4 + AspNetIdentity] setup
/*
SQL DDL scripts generated using
dotnet ef database update
for the IdentityServer4.Samples 6_AspNetIdentity quick start. This was run for
commit 0a7400a2ade8c149b3feb08a05bf4423d19ac08c in that repository. It references
- IdentityServer4.AspNetIdentity 2.0.0 including
- Microsoft.AspNetCore.Identity (>= 2.0.1)
@jeroenheijmans
jeroenheijmans / CsharpBuddy.cs
Last active April 16, 2018 07:35
CsharpBuddy
/* DISCLAIMER:
* This code is pure adhoc magic. NO WARRANTY or guarantees or
* whatsoever! Use at your own risk!!
*/
using System;
using System.Collections.Generic;
using System.Linq;
namespace CsharpBuddy
@jeroenheijmans
jeroenheijmans / NgbDateStringParserFormatter.ts
Last active June 5, 2018 18:19
Parser/formatter for ngbDatepicker with dd-MM-yyyy format
// Formatter using "dd-MM-yyyy" string format:
// See: https://ng-bootstrap.github.io/#/components/datepicker/api#NgbDateParserFormatter
//
export class NgbDateStringParserFormatter extends NgbDateParserFormatter {
parse(value: string): NgbDateStruct {
if (!value) { return null; }
const parts = value.trim().split('-');
return {
@jeroenheijmans
jeroenheijmans / ngb-momentjs-adapter.ts
Last active March 3, 2022 13:34
NgbDateAdapter for Moment.js values
import { NgbDateAdapter, NgbDateStruct } from '@ng-bootstrap/ng-bootstrap';
import { Injectable } from '@angular/core';
import * as moment from 'moment';
// Might need to polyfill depending on needed browser support...
const isInt = Number.isInteger;
@Injectable()
export class NgbMomentjsAdapter extends NgbDateAdapter<moment.Moment> {
@jeroenheijmans
jeroenheijmans / decorated-oauth-storage.ts
Created June 13, 2018 11:18
OAuthStorage wrapper for debugging angular-oauth2-oidc library
// Usage:
// { provide: OAuthStorage, useValue: decoratedStorage },
const decoratedStorage: OAuthStorage = {
getItem(key) {
const data = localStorage.getItem(key);
console.warn('get', key, data ? data.substring(0, 25) : data);
return data;
},
setItem(key, data) {
@jeroenheijmans
jeroenheijmans / angular-oauth2-oidc-extra-logging-snippet.ts
Last active May 20, 2019 12:15
Custom logging for angular-oauth2-oidc library
import { OAuthErrorEvent } from 'angular-oauth2-oidc';
// ...
this.authService.events.subscribe(event => {
if (event instanceof OAuthErrorEvent) {
console.error(event);
} else {
console.warn(event);
}
@jeroenheijmans
jeroenheijmans / choco-install.ps1
Last active November 16, 2018 10:23
Chocolatey Install DevTools
choco install adobereader -y
choco install googlechrome -y
choco install firefox -y
choco install 7zip -y
choco install notepadplusplus -y
choco install git -y
choco install putty -y
choco install nodejs -y
choco install skype -y
choco install sysinternals -y