Skip to content

Instantly share code, notes, and snippets.

View CanRau's full-sized avatar
🤓
coding

Can Rau CanRau

🤓
coding
View GitHub Profile
@barelyhuman
barelyhuman / *pipe.md
Last active November 12, 2023 23:26
pipe

Ever changing implementations of pipes that I reimplement in each codebase for different use cases.

If you do want a package instead. You should go with this https://github.com/barelyhuman/pipe

@mjackson
mjackson / redirects-in-react-router-v6.md
Last active November 12, 2023 07:32
Notes on handling redirects in React Router v6, including a detailed explanation of how this improves on what we used to do in v4/5

Redirects in React Router v6

An important part of "routing" is handling redirects. Redirects usually happen when you want to preserve an old link and send all the traffic bound for that destination to some new URL so you don't end up with broken links.

The way we recommend handling redirects has changed in React Router v6. This document explains why.

Background

In React Router v4/5 (they have the same API, you can read about why we had to bump the major version here) we had a <Redirect> component that you could use to tell the router when to automatically redirect to another URL. You might have used it like this:

@ItsWendell
ItsWendell / with-next-link.ts
Created July 22, 2021 22:15
withNextLink - Higher Order Component for Linkable components to support Next.JS Routing / Links
@andrelandgraf
andrelandgraf / createSitemap.ts
Last active January 29, 2024 08:36
sitemap.xml generator for remix.run
import childProcess from 'child_process';
import fs from 'fs';
import dotenv from 'dotenv';
import prettier from 'prettier';
const rootDir = process.cwd();
dotenv.config({
path: `${rootDir}/.env.production`,
});
@JakeGinnivan
JakeGinnivan / Pulumi.yaml
Last active January 12, 2023 10:17
Pulumi /w TypeScript project references + dynamodb lock
name: serverless-mono
description: Serverless mono infrastructure
backend:
url: s3://my-pulumi-state-bucket
runtime:
name: nodejs
options:
typescript: false
lock:
region: ap-southeast-2
@CanRau
CanRau / Basics.md
Last active March 12, 2023 21:32
[SQLite Notes] #SQLite

insert multiple

INSERT INTO table1 (column1,column2 ,..)
VALUES 
   (value1,value2 ,...),
   (value1,value2 ,...),
    ...
   (value1,value2 ,...);

Keybase proof

I hereby claim:

  • I am canrau on github.
  • I am canrau (https://keybase.io/canrau) on keybase.
  • I have a public key ASDcjXYRMtWtmJKpTow9SS7FahCJbrnILp30C51yJrH_7Ao

To claim this, I am signing this object:

@CanRau
CanRau / gtm-utm-remover.js
Last active April 22, 2019 04:11
Removes all query parameters from the url beginning with 'utm_', leaves anchors (#) and other query params alone
/**
* GTM utm_ remover
* License: MIT
* Author: @CanRau
* Version: 0.2.0
*
* Removes all query parameters from the url beginning with 'utm_'
* Leaves anchors (#) and other query params alone, so
* example.com/?session=SESSIONID&utm_source=instagram#content
* would become
@bcnzer
bcnzer / cloudflareworker-verifyjwt.js
Last active March 21, 2024 14:09
Sample Cloudflare worker that gets the JWT, ensures it hasn't expired, decrypts it and returns a result
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
// Following code is a modified version of that found at https://blog.cloudflare.com/dronedeploy-and-cloudflare-workers/
/**
* Fetch and log a request
* @param {Request} request
*/