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
@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
@nkoehring
nkoehring / isso_error.txt
Created November 2, 2015 21:38
isso python error
Traceback (most recent call last):
File "/usr/bin/isso", line 9, in <module>
load_entry_point('isso==0.9.10', 'console_scripts', 'isso')()
File "/usr/lib/python3.5/site-packages/isso/__init__.py", line 259, in main
from gevent.pywsgi import WSGIServer
File "/usr/lib/python3.5/site-packages/gevent/__init__.py", line 41, in <module>
from gevent.hub import get_hub, iwait, wait
File "/usr/lib/python3.5/site-packages/gevent/hub.py", line 289
except Exception, ex:
^

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:

# pSy's zshell prompt
# zsh theme requires 256 color enabled terminal
# based on sporty_256 and fishy
_collapsed_path() {
#TODO: collapse path elements until the path is short enough
#TODO eg: "/foo/bar/baz/quux/quarz" becomes "/f/b/baz/quux/quarz" if it still fits
#TODO or "/f/b/b/q/quarz" in the 2nd shortest form, "quarz" in the shortest
# http://lavica.fesb.hr/cgi-bin/info2html?(zsh)The%20zsh/pcre%20Module