Skip to content

Instantly share code, notes, and snippets.

View nkoehring's full-sized avatar

Norman nkoehring

View GitHub Profile
@nkoehring
nkoehring / useLocales.ts
Created December 18, 2022 11:31
Automatically load all necessary namespaces when switching the locale in typesafe-i18n
import { watch } from 'vue'
import type { Locales, Namespaces } from '@i18n/i18n-types'
import { isNamespace } from '@i18n/i18n-util'
import { loadNamespaceAsync } from '@i18n/i18n-util.async'
import { typesafeI18n } from '@i18n/i18n-vue'
import { useRoute } from 'vue-router/auto'
function loadNamespaces(locale: Locales, namespaces: Namespaces[], setLocale: (l: Locales) => void) {
console.debug('loading locale namespaces', namespaces)
const loaders = namespaces.map((l) => loadNamespaceAsync(locale, l))
BEGIN MESSAGE.
DvulbW4XHp4doue cJM1wKBngb2eGS3 aHtaXLjSISR9sRt ua2dFonEwPqcJix
PuenAVnBKI6oE2D tCgYmYCWCp3TCKq 6Xr2MZHgg6Sb2G9 VqiaieF3afW7cJm
ZuFHOD7yIQBjXYg mLf51D1neUSEdVD tVGdePSM2SLKHSg bJNp86NOX3hugD9
01EWZXiUvKWwjBs omChn3NxWaZndqW KnDvk29HFxl.
END MESSAGE.
@nkoehring
nkoehring / sub.js
Created October 25, 2018 23:47
sub
function sub () {
const subs = Object.values(arguments)
return subs.reduce((acc, v) => acc - v, subs.shift())
}
const a = sub(9); // a should be 9
const b = sub(9, 4); // b should be 5
const c = sub(14, 2, 6); // c should be 6
console.log({a, b, c})
" Settings
set nosmoothscroll
set noautofocus " The opposite of autofocus; this setting stops
" sites from focusing on an input box when they load
set typelinkhints
let searchlimit = 30
let scrollstep = 70
let barposition = "bottom"
let hintchars = hjklasdfgyuiopqwertnmzxcvb
set scalehints

Keybase proof

I hereby claim:

  • I am nkoehring on github.
  • I am koehr (https://keybase.io/koehr) on keybase.
  • I have a public key ASDPasu6nAlqAUbMaT0ob__xkvsskGNKgVVkoLnbfHu2aAo

To claim this, I am signing this object:

@nkoehring
nkoehring / blockstack.verification
Created February 23, 2017 13:36
Verifying that "koehrr.id" is my Blockstack ID. https://onename.com/koehrr
Verifying that "koehrr.id" is my Blockstack ID. https://onename.com/koehrr
@nkoehring
nkoehring / numbers.cpp
Last active June 5, 2016 17:42
read line delimited floating numbers from a file
#include <iostream>
#include <fstream>
#include <stdlib.h>
using namespace std;
int main ()
{
double arr[5];
string tmp;
int i = 0;
var csv = require("node-csv").createParser()
csv.parseFile('./test/mikko.csv', (err, data) => {
var result = {}
var keys = data[0].slice(1)
var data = data.slice(1)
var obj
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
struct Point {
int x;
int y;
struct Point *next;
};
@nkoehring
nkoehring / vimrc
Last active December 30, 2015 11:18
my vimrc at work, nice and small thanks to Vundle plugins
set nocompatible
set expandtab
set shiftwidth=4
set tabstop=4
set softtabstop=4
set autoindent
set encoding=utf-8
set textwidth=101
set colorcolumn=101
set scrolloff=5