Skip to content

Instantly share code, notes, and snippets.

View Svish's full-sized avatar
💭
Onwards and upwards

Torleif Berger Svish

💭
Onwards and upwards
View GitHub Profile
@Svish
Svish / isValidFodselsnummer.spec.ts
Last active December 8, 2021 09:09
Funksjon som sjekker om noe er et gyldig fødselsnummer
import { isValidFodselsnummer } from '.';
describe(isValidFodselsnummer.name, () => {
valid.forEach((fnr) => {
it(`"${fnr}" er et gyldig fødselsnummer`, () => {
expect(isValidFodselsnummer(fnr)).toBe(true);
});
});
invalid.forEach((fnr) => {
@Svish
Svish / QueryProvider.tsx
Created March 8, 2021 09:47
react-query setup
import React, { useMemo } from 'react';
import {
QueryClientProvider,
QueryClient,
QueryCache,
MutationCache,
} from 'react-query';
import { ReactQueryDevtools } from 'react-query/devtools';
import { createDefaultQueryFn } from './defaultQueryFn';
@Svish
Svish / ErrorBoundary.tsx
Created April 28, 2020 13:03
ErrorBoundary listening to react-router history
import React from 'react';
import render, { RenderProp } from 'common/react/render';
import history from 'util/history';
import { UnregisterCallback } from 'history';
type ErrorInfo = { componentStack: string };
type CaughtError = Error & ErrorInfo;
interface State {
@Svish
Svish / keybase.md
Created July 8, 2019 20:17
keybase.md

Keybase proof

I hereby claim:

  • I am svish on github.
  • I am svish (https://keybase.io/svish) on keybase.
  • I have a public key ASBPE3F4o2NgH4-oaE41Y4ATJ5H-nYiVLG5bYpvKgJ_CKQo

To claim this, I am signing this object:

@Svish
Svish / level.lua
Created September 17, 2012 20:09
ComputerCraft turtle script for leveling a rectangular area
-- Helper function for looping over a range
function range(limit)
local function seq(state, x)
if (x >= limit) then
return nil
else
return x + 1
end
end
return seq, nil, 0