Skip to content

Instantly share code, notes, and snippets.

View jeroenheijmans's full-sized avatar

Jeroen Heijmans jeroenheijmans

View GitHub Profile
@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 / 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 / UploadMultipartForm.psm1
Created January 5, 2017 09:42
Powershell Module with cmdlet to upload files in a multipart-form POST
<#
# It can be called like this:
$url ="http://localhost:12345/home/upload"
$form = @{ description = "Test 123." }
$pwd = ConvertTo-SecureString "s3cr3t" -AsPlainText -Force
$creds = New-Object System.Management.Automation.PSCredential ("john", $pwd)
Get-ChildItem *.txt | Send-MultiPartFormToApi $url $form $creds -Verbose -WhatIf
#>
@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 / 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 / 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
@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 / Foo.Tests.csproj
Created August 19, 2019 12:01
FluentValidation auto-registration with string validators repro
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
@jeroenheijmans
jeroenheijmans / destroyable.component.spec.ts
Created February 16, 2020 14:00
Destroyable Angular component
import { Subject } from 'rxjs';
import { Destroyable } from './destroyable.component';
class TestableDestroyable extends Destroyable { }
describe('Destroyable', () => {
it('should construct with observable', () => {
const component = new TestableDestroyable();
expect(component.destroyed$ instanceof Subject).toBeTruthy();
});