Skip to content

Instantly share code, notes, and snippets.

View mhaidarhanif's full-sized avatar
🧊
developing people and software

M Haidar Hanif mhaidarhanif

🧊
developing people and software
View GitHub Profile
@kiliman
kiliman / README.md
Last active May 15, 2024 11:23
Debug server-side Remix using VSCode

💡 HOWTO: Debug your server-side Remix code using VSCode

✨ New in Remix v1.3.5

The latest release of Remix fixes sourcemaps so you no longer need to use any hacks to set breakpoints in your route modules. Simply start the debugger and Remix will hit the breakpoint in your loaders and actions.

Debugging session even survives edits and Live Reload.

@edmundhung
edmundhung / Progress.tsx
Last active March 14, 2023 15:25
Setting up a global loading indicator in Remix
import type { ReactElement, MutableRefObject } from 'react';
import { useEffect, useRef } from 'react';
import { useTransition } from 'remix';
export function useProgress(): MutableRefObject<HTMLElement> {
const el = useRef<HTMLElement>();
const timeout = useRef<NodeJS.Timeout>();
const { location } = useTransition();
useEffect(() => {
@sergiodxa
sergiodxa / entry.server.tsx
Last active May 7, 2024 12:30
Dynamically generate a PDF with Remix
import { renderToStream } from "@react-pdf/renderer";
import ReactDOMServer from "react-dom/server";
import { EntryContext, Headers, RemixServer, Request, Response } from "remix";
import PDF, { loader } from "./pdfs/my-pdf.server";
async function handlePDFRequest(request: Request, headers: Headers) {
// get the data for the PDF
let response = await loader({ request, context: {}, params: {} });
// if it's a response return it, this means we redirected
if (response instanceof Response) return response;
@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`,
});
@mcansh
mcansh / !RemixVercelGitHubAction.markdown
Last active February 27, 2024 14:34
GitHub Action for automatically deploying a Remix app to Vercel

Things to note to make this work:

  1. you'll need to have your remix registry token available in your shell under REMIX_TOKEN
  2. you'll need to add secrets to your GitHub repo for the following items:
  3. you'll need to have your REMIX_TOKEN available in your vercel repo as an environment variable
@ryanflorence
ryanflorence / $post.edit.tsx
Last active March 9, 2022 22:50
The Anatomy of a Remix Route
/**
* The Anatomy of a Remix Route
*/
import { parseFormBody, json, redirect } from "@remix-run/data";
import {
Form,
useRouteData,
usePendingFormSubmit,
preload,
} from "@remix-run/react";
@Zekfad
Zekfad / conventional-commits.md
Last active May 17, 2024 04:30
Conventional Commits Cheatsheet

Quick examples

  • feat: new feature
  • fix(scope): bug in scope
  • feat!: breaking change / feat(scope)!: rework API
  • chore(deps): update dependencies

Commit types

  • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci: Changes to CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  • chore: Changes which doesn't change source code or tests e.g. changes to the build process, auxiliary tools, libraries
@MichaelSimons
MichaelSimons / RetrievingDockerImageSizes.md
Last active May 20, 2024 12:11
Retrieving Docker Image Sizes

Retrieving Docker Image Sizes

There are two metrics that are important to consider when discussing the size of Docker images.

  1. Compressed size - This is often referred to as the wire size. This affects how fast/slow images can be pulled from a registry. This impacts the first run experience on machines where images are not cached.
  2. Uncompressed size - This is often referred to as the size on disk. This affects how much local storage is required to support your Docker workloads.

The example commands shown below will work on Windows, MacOS, and Linux.

How to Measure the Compressed Size

@fnky
fnky / stripe-keys-and-ids.tsv
Last active May 14, 2024 14:09
Stripe keys and IDs
Prefix Description Notes
ac_ Platform Client ID Identifier for an auth code/client id.
acct_ Account ID Identifier for an Account object.
aliacc_ Alipay Account ID Identifier for an Alipay account.
ba_ Bank Account ID Identifier for a Bank Account object.
btok_ Bank Token ID Identifier for a Bank Token object.
card_ Card ID Identifier for a Card object.
cbtxn_ Customer Balance Transaction ID Identifier for a Customer Balance Transaction object.
ch_ Charge ID Identifier for a Charge object.
cn_ Credit Note ID Identifier for a Credit Note object.
@bradtraversy
bradtraversy / node_nginx_ssl.md
Last active May 20, 2024 10:49
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user