Skip to content

Instantly share code, notes, and snippets.

View justinnoel's full-sized avatar

Justin Noel justinnoel

View GitHub Profile
@justinnoel
justinnoel / combining-git-repositories.md
Created December 29, 2025 14:55 — forked from msrose/combining-git-repositories.md
How to combine two git repositories.

Combining two git repositories

Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:

  • preserve all commits of both repositories, but replace everything from A with the contents of B, and use rA as your remote location
  • actually combine the two repositories, as if they are two branches that you want to merge, using rA as the remote location

NB: Check out git subtree/git submodule and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.

Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.

@justinnoel
justinnoel / package.json
Last active December 19, 2023 13:47
Hono Tailwind for Dev and Production
{
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build && vite build --mode client && npx tailwindcss -i ./src/index.css -o ./dist/static/assets/index.css --minify",
"format": "prettier --config .prettierrc --ignore-path .prettierignore '**/*.{json,js,jsx,ts,tsx,css,scss,md}' --write",
"lint": "eslint --ext \".js,.jsx,.ts,.tsx\" --ignore-path .eslintignore . --max-warnings 0 --fix",
"prepare": "husky install"
},
"husky": {
@justinnoel
justinnoel / log-remote.ts
Last active June 13, 2023 22:42
Send logs to external service in a Cloudflare Remix project
type LogRemote = {
details: {
message: string,
},
env: {
REMOTE_LOGGING_URL: string,
REMOTE_LOGGING_KEY: string,
REMOTE_LOGGING_SOURCE: string,
},
};
@justinnoel
justinnoel / App.tsx
Created December 9, 2022 16:57
Jason Workout App
<Register history={props.history} />
@justinnoel
justinnoel / README.md
Created November 12, 2022 12:34
Configuring Sessions in Remix for Cloudflare Pages
@justinnoel
justinnoel / zeptomail_3.0.2_modifications.js
Created September 9, 2022 17:06
ZeptoMail JS Client 3.0.2 Issues
import fetch from 'node-fetch';
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) {
symbols = symbols.filter(function (sym) {
@justinnoel
justinnoel / cf-worker.js
Created June 20, 2022 17:53
Example of very simple API used while learning front-end development
addEventListener("fetch", (event) => {
event.respondWith(handleRequest(event.request));
});
const workouts = [
{
week: 1,
starts: 18383383383,
workout: [
{
@justinnoel
justinnoel / sample-cloudflare-worker-post-processor.js
Last active April 22, 2022 19:42
A Cloudflare Worker to extract POST data submitted as either JSON or as a form.
addEventListener("fetch", (event) => {
event.respondWith(handleRequest(event.request).catch((err) => new Response(err.stack, {status: 500})));
});
async function handleRequest(request) {
const {pathname} = new URL(request.url);
if (pathname.startsWith("/api/post")) {
const {data, error} = await getPostData(request);
if (error) {
return new Response(error, {status: 400})
@justinnoel
justinnoel / getPostData.js
Created January 29, 2022 15:19
Get POST data submitted as either JSON or FormData
export async function getPostData(request) {
const {headers} = request;
const contentType = headers.get("content-type") || "";
if (contentType.includes("application/json")) {
return await request.json();
}
if (contentType.includes("form")) {
const formData = await request.formData();
@justinnoel
justinnoel / gist:74f28a203672b66aaee80629991f5edb
Created December 14, 2021 19:45 — forked from cryptoskillz/gist:98b8e7090b7cc8d51531bb9dcfe7654a
Tips on how to use a KV namespace with Cloudflare Pages
This gist aims to show you how to use KV datastore using Cloudflare pages. The reason I created this quick guide is it took
me almost 2 weeks to get it working, mainly because it is very new and the documentation is not up fully fleshed out yet
https://developers.cloudflare.com/workers/runtime-apis/kv
https://developers.cloudflare.com/pages/platform/functions
https://blog.cloudflare.com/wrangler-v2-beta/
Steps:
Install wrangler 2