Skip to content

Instantly share code, notes, and snippets.

View ritmoHung's full-sized avatar
☝️
君をハナセナイ🫴

洪顥耘 ritmoHung

☝️
君をハナセナイ🫴
View GitHub Profile
@nivethan-me
nivethan-me / README.md
Last active September 4, 2024 06:41
Add Cloudflare Custom Domain to Vercel

Add Cloudflare custom domain to Vercel

  1. Sign up and sign in to Cloudflare https://dash.cloudflare.com/sign-up.
  2. In your Cloudflare dashboard, select the Domain Registration > Register Domains tab.
  3. Search for your favorite domain and purchase it. In my case, I purchased the domain https://nivethan.me/ for my portfolio.
  4. Sign in to Vercel and go to your dashboard, where you can see all your projects in the Overview tab.
  5. Click on a project and on the top right, select Domains.
  6. Type your domain in the text box, e.g., nivethan.me, and click Add.
  7. Select the recommended option: Add www.nivethan.me and redirect nivethan.me to it.
  8. Vercel will show an invalid configuration under your domains and display the relevant A record IP under nivethan.me and a CNAME IP under www.nivethan.me. These need to be set up on Cloudflare to make it work.
@aegrumet
aegrumet / decrypt-nextauth-jwe.go
Created December 4, 2022 01:24
Decrypt a NextAuth jwe from somewhere else
package main
import (
"crypto/sha256"
"fmt"
"io"
"github.com/lestrrat-go/jwx/v2/jwa"
"github.com/lestrrat-go/jwx/v2/jwe"
"golang.org/x/crypto/hkdf"
@shuding
shuding / swr-suspense-journey.md
Created September 14, 2021 12:18
The Journey of SWR and Suspense

The Journey of SWR and Suspense

We are trying to combine the idea of SWR ("stale-while-revalidate") and React Suspense together, and this write-up covers all our findings from this journey.

Background

When React Hooks launched, people started to rely on useEffect to initiate data fetching:

function User () {
@zlovatt
zlovatt / getFocusedComp.jsx
Last active September 20, 2022 03:55
Extendscript: Gets currently open comp from timeline, as opposed to selected comp in project panel
(function () {
/**
* Gets currently open comp from timeline, as opposed to
* selected comp in project panel
*
* @returns {CompItem | null} Active comp, or null if none
*/
function getFocusedComp() {
var activeItem = app.project.activeItem;
@wojtekmaj
wojtekmaj / .gitignore
Last active July 25, 2024 06:12
How to upgrade Yarn to Yarn Modern (v4 at the moment) seamlessly
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
@jcherven
jcherven / WindowsSystemFont-RestoreSegoeUI.reg
Created December 31, 2019 16:48
Restore Segoe UI as the Windows 10 system UI font (rolls back changes from companion script)
Windows Registry Editor Version 5.00
; This is a companion script for https://gist.github.com/jcherven/42b84294248674c29eb50cb711114315
; Rolls back changes made by the above registry patch script
; Don't edit this file; save and double click to run.
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts]
"Segoe UI (TrueType)"="segoeui.ttf"
@ziluvatar
ziluvatar / token-generator.js
Last active August 26, 2024 18:36
Example of refreshing tokens with jwt
/**
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken
* It was requested to be introduced at as part of the jsonwebtoken library,
* since we feel it does not add too much value but it will add code to mantain
* we won't include it.
*
* I create this gist just to help those who want to auto-refresh JWTs.
*/
const jwt = require('jsonwebtoken');
@liam-middlebrook
liam-middlebrook / GLDebugMessageCallback.c
Last active September 4, 2024 04:21
GL Debug Output Message Callback Guide
// This is free and unencumbered software released into the public domain.
//
// Anyone is free to copy, modify, publish, use, compile, sell, or distribute
// this software, either in source code form or as a compiled binary, for any
// purpose, commercial or non-commercial, and by any means.
//
// In jurisdictions that recognize copyright laws, the author or authors of this
// software dedicate any and all copyright interest in the software to the
// public domain. We make this dedication for the benefit of the public at large
// and to the detriment of our heirs and successors. We intend this dedication