Skip to content

Instantly share code, notes, and snippets.

View jestho's full-sized avatar

Jesper Thøgersen jestho

View GitHub Profile
type UUID = string & { UUID: never };
export const uuid = () =>
"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
const r = (Math.random() * 16) | 0;
const v = c == "x" ? r : (r & 0x3) | 0x8;
return v.toString(16);
}) as UUID;
import React, { useState } from "react";
import styled from "styled-components";
export const Tabs: React.FC<{
disabled?: boolean;
titles: string[];
children: React.ReactNodeArray;
}> = p => {
if (p.disabled) {
return <>{p.children}</>;
@jestho
jestho / Mod.tsx
Last active November 28, 2018 13:02
import styled from "styled-components";
interface IPadding {
pt?: string;
pr?: string;
pb?: string;
pl?: string;
pa?: string;
pv?: string;
ph?: string;
@jestho
jestho / keycodes.d.ts
Last active July 1, 2022 15:24 — forked from kyranjamie/keycodes.ts
TypeScript Browser Key Codes Enum
declare enum keyCodes {
BACKSPACE = 8,
TAB = 9,
ENTER = 13,
SHIFT = 16,
CTRL = 17,
ALT = 18,
PAUSE = 19,
CAPS_LOCK = 20,
ESCAPE = 27,
@jestho
jestho / package.json
Created February 27, 2017 22:03
Quick Sass/BrowserSync
{
"name": "flow",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "npm-run-all --parallel styles:watch browsersync",
"styles:watch": "node-sass --watch style.scss style.css",
"browsersync": "browser-sync start --server --files \"*.html, *.js, *.css\""
},
@jestho
jestho / esnextbin.md
Last active October 13, 2016 10:18
esnextbin sketch
@jestho
jestho / esnextbin.md
Created March 20, 2016 19:21
esnextbin sketch
@jestho
jestho / SuperDuperBreakpoints.css
Last active August 29, 2015 14:27
Generated by SassMeister.com.
/* Media Query */
@media (max-width: 767px) {
body {
content: "Small screen"; } }
@media (min-width: 768px) and (max-width: 1024px) {
body {
content: "Medium screen"; } }
@media (min-width: 1025px) {
@jestho
jestho / getset.scss
Last active January 30, 2016 21:23
set/get args
// ----
// libsass (v3.2.5)
// ----
$args-map: () !default;
@function set($id, $args...) {
$new-args: ($id: $args);
$args-map: map-merge($args-map, $new-args) !global;
@return map-get($args-map, $id);
@jestho
jestho / arrows.scss
Last active January 30, 2016 21:21
Generated by SassMeister.com.
// ----
// Sass (v3.4.12)
// Compass (v1.0.3)
// ----
div {
background: #000;
margin: 1em auto;
width: 5em;
height: 5em;