Skip to content

Instantly share code, notes, and snippets.

View aeinbu's full-sized avatar

Arjan Einbu aeinbu

View GitHub Profile
@aeinbu
aeinbu / tasks.json
Last active October 16, 2018 12:47
Visual Studio Code task for running mocha tests with problem matcher
{
"version": "0.1.0",
"command": "mocha",
"isShellCommand": true,
"showOutput": "silent",
"args": [
"--reporter",
"tap",
"--colors"
],
@aeinbu
aeinbu / .eslintrc.json
Last active May 6, 2019 09:07
My ESLint file
module.exports = {
"env":
{
"browser": true,
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"parserOptions":
{
@aeinbu
aeinbu / .babelrc
Last active December 16, 2019 20:00
{
"presets": [
["@babel/preset-env", {"modules": "commonjs"}]
],
"plugins": [
["@babel/plugin-proposal-object-rest-spread", {}],
["@babel/plugin-proposal-class-properties", { "loose": false }],
["@babel/plugin-proposal-nullish-coalescing-operator"],
["@babel/plugin-proposal-optional-chaining"],
["@babel/plugin-proposal-pipeline-operator", { "proposal": "minimal" }]
@aeinbu
aeinbu / wrapInDebugModeProxy.tests.ts
Created May 8, 2020 07:01
Makes new object that guards against executing methods and changing properties when not in debug mode
import { wrapInDisablerProxyFactory } from "./wrapInDebugModeProxy"
describe("Enable/disable functions", () => {
const obj = {
flipTheFlag(target) {
target.flag = true
},
inner: {
anotherFlipTheFlag(target) {
function Deferred() {
this.resolve = null;
this.reject = null;
this.promise = new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});
}
@aeinbu
aeinbu / chain.js
Created May 14, 2019 08:57
Helper to chain method calls while we're waiting for |> (the js pipe operator)
const chain = (obj, op = obj => obj, ...restOps) => restOps.length > 0
? chain(op(obj), ...restOps)
: op(obj);
function round(value, precision) {
return Number(Math.round(value + "e" + precision) + "e-" + precision)
}
function strictCompare(left, right) {
console.log(`strictCompare(${left}, ${right})`);
return left === right;
}
@aeinbu
aeinbu / .gitconfig
Last active July 29, 2021 13:39
Some practial aliases for Git
[alias]
refresh = !git fetch --all --prune && git checkout master && git pull --rebase && git lastbranch
amend = commit --amend --no-edit
lastbranch = checkout @{-1}
ql = log -10 --oneline --decorate --graph
qb = "!qb(){ git refresh && git checkout -b aei/PPN-$@; }; qb"
qc = "!qc(){ git checkout aei/PPN-$@; }; qc"
qa = "!qa(){ git refresh && git branch --remote | grep $@ | sed 's/origin\\///' | xargs git checkout && git pull --rebase && git rebase master; }; qa"

How to add a new disk in Linux

This post takes you through creating a partition, formatting it and finally mount it in the filesystem.

These procedures where tested on Linux Mint 19

List disks and partitions

$ sudo fdisk -l

The result will vary depending on the number of disk you have. On my computer I got these three entries:

public abstract record StronglyTypedId<TValue>(TValue Value)
where TValue : notnull
{
public override sealed string ToString() => $"{Value}";
}