This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
the twitter api is stupid. it is stupid and bad and expensive. hence, this. | |
Literally just paste this in the JS console on the bookmarks tab and the script will automatically scroll to the bottom of your bookmarks and keep a track of them as it goes. | |
When finished, it downloads a JSON file containing the raw text content of every bookmark. | |
for now it stores just the text inside the tweet itself, but if you're reading this why don't you go ahead and try to also store other information (author, tweetLink, pictures, everything). come on. do it. please? | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import vm from "node:vm"; | |
import path from "node:path"; | |
import glob from "glob"; | |
const routes = glob.sync(path.join(basePath, "/public/build/routes/**/*.js")); | |
const stylesheets = []; | |
function linker(specifier) { | |
const module = fs.readFileSync(path.join(basePath, "public", specifier)); | |
if (!module) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import notifierQueue from "~/queues/notifier.server.ts"; | |
export const loader = async () => { | |
await notifierQueue.add("test", { emailAddress: "[email protected]" }); | |
return null; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { ActionFunction } from "remix"; | |
import { Form, redirect, useTransition } from "remix"; | |
import { enqueueDeleteUserData } from "~/app/routes/queues/delete-user-data"; | |
import authenticator from "~/app/auth/authenticator"; | |
import { destroySession, getSession } from "~/utils/session.server"; | |
import db from "~/utils/db.server"; | |
export const action: ActionFunction = async ({ request }) => { | |
const user = await authenticator.isAuthenticated(request, { failureRedirect: "/auth/sign-in" }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Worker } from "worker_threads"; | |
import path from "path"; | |
import fs from "fs"; | |
import { nanoid } from "nanoid"; | |
type Handler<Job> = (job: Job) => Promise<void> | void; | |
export class BackgroundJob<Job> { | |
private static readonly workersDir = "/tmp/background-jobs"; | |
private readonly workerPath: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import type { FunctionComponent } from "react"; | |
export const combineProviders = (providers: FunctionComponent[]) => providers.reduce( | |
(Combined, Provider) => ({ children }) => ( | |
<Combined> | |
<Provider>{children}</Provider> | |
</Combined> | |
), | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jwt from "jsonwebtoken"; | |
import { User } from "./entities/user"; | |
export function generateSignInUrl(user: User) { | |
const token = generateSignInToken(user); | |
return `${process.env.APP_URL}/auth/verify?token=${token}`; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare global { | |
interface Window { Paddle: any; } | |
} | |
const VENDOR_ID = 111; | |
const PRODUCT_ID = 222; | |
type BuyParams = { | |
coupon?: string | null; | |
meta?: Record<string, string>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function serializeServerDataToJsonString(data: Object): string { | |
const jsonString = JSON.stringify(data); | |
return jsonString | |
.replace(/<\/script/gim, '</_escaped_script') | |
.replace(new RegExp('\u2028', 'g'), '\\u2028') | |
.replace(new RegExp('\u2029', 'g'), '\\u2029') | |
.replace(/\\/g, '\\\\') | |
.replace(/\n/g, '\\n') | |
.replace(/\r/g, '\\r') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo "Error: No argument passed" >&2; exit 1 | |
fi | |
if ! [[ $1 =~ ^[0-9]+$ ]] ; then | |
echo "Error: Argument is not a number" >&2; exit 1 | |
fi | |
PIDToKill=$(lsof -i:$1 | grep LISTEN | awk '{print $2}' | uniq) |
NewerOlder