Posts
Karl Sandin
Cancel

Outside click detect

Detects outside click, an example usage is when a user click outside of a dropdown menu and you want to close it. index.js 1 2 3 4 5 6 7 8 9 10 11 12 import React from "react"; import { render } f...

Regex for swedish social security numbers

Simple JS regexp for swedish social security number. 1 2 3 4 5 6 7 /^\d{6,8}[-|(\s)]{0,1}\d{4}$/.test("195505055555") // true /^\d{6,8}[-|(\s)]{0,1}\d{4}$/.test("19550505-5555") // true /^\d{6,8...

Simple debounce snippet

The arguments this takes are: a - A function to be debounced b - A period of time to wait before debouncing c - A controller for whether to call the function before or after the timer. If falsey...