all blog posts

JavaScript RegExp Tutorial

5 Mar 2019

A cheat sheet for the regex syntax in JavaScript.

MDN RegExp Guide

TL&DR

''.test(/^$/);
'ok'.replace(/(.)(.)/g, '$2$1'); // $$, $&, $`, $'

const matchG = 'aaa'.match(/a/g);
matchG == ['a', 'a', 'a'];

const matchNoG = 'str'.match(/(st)r/);
matchNoG == Object.assign(['str', 'st'], {groups: undefined, index: 0, input: 'str'});
matchNoG == /(st)r/.exec('str');
cheat-sheet regex

Rubber Duck Debugging

27 Feb 2019

Talk to the Duck

When confronted with a problem, don’t ask the person next to you for help right away, he’s probably doing something important as well!

Instead, first tell the duck about it - out loud. If you don’t get to a solution, start explaining your problem in more and more detail until it hits you. If the mere explanation led to a solution, you avoid unwillingly turning your colleague into a CardboardProgrammer.

debugging

Create a new blog post

25 Feb 2019

This is something for me (or anyone else really) because I keep forgetting all this stuff.

Diving right in:

Use {: .hide-from-excerpt} to do just that.

meta

Array.prototype for .NET developers

24 Feb 2019

The Array.prototype functions have been available for a long time but it’s since Arrow functions that “Linq lambda syntax”-like functionality is available in JavaScript.

This blog post explains the most common functions by comparing them to their C# equivalents.

A basic example:

// JavaScript
const result = [0, 1, 2, 3, null]
    .filter(x => x !== null)
    .map(x => x * 10)
    .sort((a, b) => b - a);

expect(result).toEqual([30, 20, 10, 0]);

// C#
var result = new int?[] {0, 1, 2, 3, null}
    .Where(x => x != null)
    .Select(x => x * 10)
    .OrderByDescending(x => x)
    .ToArray();
cheat-sheet tutorial

Debugging in Visual Studio

24 Feb 2019

Basic Shortcuts

F5 : Start debugging
Control + F5 : Start without debugging
Shift + F5 : Stop debugging
Control + Shift + F5 : Stop, rebuild and start debugging
Control + Alt + P : Attach to process


Control + Alt + Break : Break (Debug > Break All)
F10 : Step over
F11 : Step into
Shift + F11 : Step out
Control + F10 : Run to cursor
Control + Shift + F10 : Set next statement
Alt + Num * : See current statement


tutorial cheat-sheet debugging

Angular Pipes

20 Feb 2019

Pipes: Chainable, declarative display-value transformations to use in your Html.

This post covers:

  • All Builtin Angular pipes (json, async, string, array)
  • How to install different locales (currency, decimal, date, percent)
  • How to generate, implement and test your custom pipes
  • Some examples of custom pipes (ngx-pipes and angular-pipes)

An example:

<!-- This does exactly what you'd think -->
{{ value | uppercase }}
angular cheat-sheet tutorial

Git Assume Unchanged

18 Feb 2019

Ideally one would create a new gitignored file to configure an application to fit his local development environment but when you do have to revert to modifying a committed configuration file, at least there is “git assume unchanged” to avoid committing your changes in these files accidently.

Assume Unchanged

# Git assume a file
git update-index --assume-unchanged fileName

# And unassume with
git update-index --no-assume-unchanged fileName
git

Autohotkey DynaRun

17 Feb 2019

Run any Autohotkey script on the web with a single.. Autohotkey hotkey.

autohotkey