all blog posts

.NET Regex Tutorial

Not nearly as confusing as it is in JavaScript.

using System.Text.RegularExpressions;

bool mach = Regex.IsMatch("input", @"\w+", RegexOptions.None);
Match match = Regex.Match("input", @"\w+");
IReadOnlyList<Match> matches = Regex.Matches("input", @"\w+");
string result = Regex.Replace("input", @"(\w+)", "$1");
19 Apr 2019
cheat-sheet regex

Vue.js Tutorial

vuejs/vue : Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

Why Vue

  • 100k+ ⭐: So many people can’t be wrong
  • Declarative rendering with a cool, terse syntax
  • Low learning curve
  • Reactive and composable view components
  • Optional official vue-router and vuex (statemanagement)
  • @vue/cli: Scaffold project with optional support for TypeScript, PWA, CSS Pre-processors, Linters, Tests, …
  • Automatic dependency tracking
  • Virtual DOM
  • Supports IE9+
19 Apr 2019
tutorial

Moment.js Tutorial

Moment.js is a legacy project, now in maintenance mode. In most cases, you should choose a different library.
See some alternatives at the end of this post.


Proceed at your own peril

Moment.js is a mutable wrapper with a fluent interface for the native JavaScript date object (property _d). Use .toDate() to convert back to a JavaScript date.

19 Apr 2019
cheat-sheet tutorial

Git Hooks with Husky

Avoid pushing changes that break the build with githooks and Husky.

typicode/husky : 🐺 Git hooks made easy

13 Apr 2019
git

Exotic Git Snippets

Some git commands and scripts that come in handy from time to time.

5 Apr 2019
git


JavaScript RegExp Tutorial

A cheat sheet for the regex syntax in JavaScript.

MDN RegExp Guide

TL&DR

/^$/.test(''); // boolean
'ok'.replace(/(o)(k)/g, '$2$1');
// Other replacements:
// $$ (literal), $& (all), $` (before), $' (after), $<name>

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');
5 Mar 2019
cheat-sheet regex

Rubber Duck Debugging

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.

27 Feb 2019
debugging