This file contains hidden or 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
let enforceSingleVersion = [ | |
'react-hot-toast', // | |
'react', | |
// '@types/react', | |
'react-dom', | |
'next-auth', | |
'next', | |
// 'date-fns', | |
// 'styled-jsx', | |
'next-themes', |
This file contains hidden or 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 { useEffect, useState } from 'react'; | |
import React from 'react'; | |
import type { BoxProps, DOMElement } from 'ink'; | |
async function main() { | |
const { render, Text, measureElement, Box } = await import('ink'); | |
interface ScrollProps { | |
onUp?: () => void; |
This file contains hidden or 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 { createId } from '@paralleldrive/cuid2' | |
import { v7, v4 } from 'uuid' | |
function cuid() { | |
let n = 1_000_000 | |
let list = [] as string[] | |
let start = Date.now() | |
for (let i = 0; i < n; i++) { | |
let id = createId() | |
list.push(id) |
This file contains hidden or 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
// original https://github.com/babel/babel/blob/9c77558234c87b9220604fbc1519089e2d6334e2/packages/babel-traverse/src/scope/lib/renamer.ts#L61 | |
import splitExportDeclaration from '@babel/helper-split-export-declaration' | |
import type { Scope } from '@babel/traverse' | |
import { visitors } from '@babel/traverse' | |
import { traverseNode } from '@babel/traverse/lib/traverse-node' | |
import * as t from '@babel/types' | |
import { NodePath, Visitor } from '@babel/core' | |
import type { Identifier } from '@babel/types' |
This file contains hidden or 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 csv | |
import json | |
def extract_messages(data, max_messages): | |
messages = [] | |
for message_id, message_data in data["mapping"].items(): | |
if message_data["message"]: | |
message = message_data["message"] | |
content = message.get("content", {}).get("parts", [""])[0] |
This file contains hidden or 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
from pypdf import PdfReader, PdfWriter | |
def remove_watermark(pdf_path, output_path): | |
reader = PdfReader(pdf_path) | |
writer = PdfWriter() | |
for page in reader.pages: | |
if '/Resources' in page and '/XObject' in page['/Resources']: |
This file contains hidden or 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
module.exports = { | |
async redirects() { | |
return [ | |
{ | |
source: '/', | |
destination: 'https://example.com/docs', | |
permanent: false, | |
}, | |
{ | |
source: '/:slug*', |
This file contains hidden or 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 path from "path"; | |
import fs from "fs"; | |
import { getPackages } from "@monorepo-utils/package-utils"; | |
const sourceDir = "src"; | |
getPackages(__dirname).map(x => { | |
let types = getTypesFile({ | |
sourceDir: path.resolve(x.location, sourceDir) | |
}); |
This file contains hidden or 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
query enumValuesOfMetaInformationTags { | |
__type(name: "META_INFORMATION_TAGS") { | |
name | |
enumValues { | |
name | |
} | |
} | |
} |
This file contains hidden or 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
const buffer = await fetch(url).then((r) => r.buffer()) | |
const content = buffer.toString('utf8') | |
// then pass this where you like |
NewerOlder