Skip to content

Instantly share code, notes, and snippets.

/*
ar-SA Arabic (Saudi Arabia)
bn-BD Bangla (Bangladesh)
bn-IN Bangla (India)
cs-CZ Czech (Czech Republic)
da-DK Danish (Denmark)
de-AT Austrian German
de-CH "Swiss" German
de-DE Standard German (as spoken in Germany)
el-GR Modern Greek
@thomaswangarchive
thomaswangarchive / convertNextJsExportIntoBrowserExtension.ts
Created March 30, 2022 19:25 — forked from webbertakken/convertNextJsExportIntoBrowserExtension.ts
Tools for exporting a NextJS application export into a Chromium browser extension
// tools/convertNextJsExportIntoBrowserExtension.ts
import { resolve } from 'path'
import { rename, rm, readdir, writeFile, readFile } from 'fs/promises'
const nextJsOutDirectory = 'out'
const extensionDirectory = 'extension'
const manifestAddon = {
manifest_version: 3,
@thomaswangarchive
thomaswangarchive / DynamicText.jsx
Created February 28, 2022 20:28
Inter dynamic tracking as a React component
// https://rsms.me/inter/dynmetrics
const DynamicText = ({ className, children, fontSize = 15, tag = "span" }) => {
const pxToRem = (px) => {
return Number(px * 0.0625)
}
const dynamicLeading = (z) => {
const l = 1.4
return Number(pxToRem(Math.round(z * l)))
.button {
appearance: none;
border: none;
font-size: 13px;
line-height: 1;
height: 25px;
border-radius: 99999px;
padding-left: 10px;
padding-right: 10px;
}
/*
- Combining Josh's "Modern CSS Reset" with Taiwind's Preflight:
- https://www.joshwcomeau.com/css/custom-css-reset/
- https://tailwindcss.com/docs/preflight
*/
* {
margin: 0;
}
/*
- From: https://courses.joshwcomeau.com/css-for-js/09-little-big-details/06-mobile-ux
*/
.pushable {
-webkit-tap-highlight-color: transparent;
user-select: none;
}
.click-target-helper::after {

Command:

curl https://git.io/ -i -F "url=https://github.com/YOUR_GITHUB_URL" -F "code=YOUR_CUSTOM_NAME"

URLs that can be created is from:

  • https://github.com/*
  • https://*.github.com
  • https://*.github.com/*
  • https://*.github.io
@thomaswangarchive
thomaswangarchive / Stack.js
Last active March 5, 2021 12:45
Stack layout component in React
import React from "react";
import styled from "styled-components";
const Stack = styled.div`
--space: ${props => props.space || "1.5rem"};
display: flex;
flex-direction: column;
justify-content: flex-start;
* {