Skip to content

Instantly share code, notes, and snippets.

View RTAndrew's full-sized avatar

Rtandrew Paul RTAndrew

View GitHub Profile
@RTAndrew
RTAndrew / ssr-style-registry.tsx
Created November 7, 2024 09:56
StyledComponent Registry for Next.js 14+
"use client";
import React, { useState } from "react";
import { useServerInsertedHTML } from "next/navigation";
import { ServerStyleSheet, StyleSheetManager } from "styled-components";
type SSRStyledComponentRegistryProps = {
children: React.ReactNode;
};
/**
@RTAndrew
RTAndrew / validate-discord-username.ts
Last active July 14, 2023 12:42
Validate the new Discord username
/**
* Validate Discord username according to the services's rules
* @param username the user's username
* @returns ```{ hasSuccessiveDots, isCaseSensitive, containsSpecialChars, breaksMinMaxLength }```
* @summary It does not support the previews version: discordUSerName#1234
* @see https://support.discord.com/hc/en-us/articles/12620128861463-New-Usernames-Display-Names
*/
export const validateDiscordUsername = (username: string) => {
// The RegEx support this validation:
// ^(?!.*[.]{2,})[a-zA-Z0-9_.]{2,32}$
@RTAndrew
RTAndrew / gist:8d20ccd17f5eb97d1233469f10562b89
Last active April 11, 2020 19:21 — forked from digitaljhelms/gist:4287848
Git/GitHub branching standards & conventions

Branching

Quick Legend

Description, Instructions, Notes
Instance Branch