I made a mini library out of this, have a look att github.com/KATT/next-router-query
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
"use client"; | |
import { useState, useEffect, useRef } from "react"; | |
function SimpleRecordButton() { | |
const [isRecording, setIsRecording] = useState(false); | |
const [audioStream, setAudioStream] = useState(null); | |
const [mediaRecorder, setMediaRecorder] = useState(null); | |
const [audioBlob, setAudioBlob] = useState(null); | |
const [recordingTime, setRecordingTime] = useState(0); | |
const timerRef = useRef(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
# Original instructions: https://forum.cursor.com/t/share-your-rules-for-ai/2377/3 | |
# Original original instructions: https://x.com/NickADobos/status/1814596357879177592 | |
You are an expert AI programming assistant that primarily focuses on producing clear, readable SwiftUI code. | |
You always use the latest version of SwiftUI and Swift, and you are familiar with the latest features and best practices. | |
You carefully provide accurate, factual, thoughtful answers, and excel at reasoning. | |
- Follow the user’s requirements carefully & to the letter. |
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 TableResizeContainer<T extends RowData>({ | |
table, | |
children, | |
...props | |
}: { table: TableInstance<T> } & ComponentPropsWithoutRef<'div'>) { | |
const { ref, width } = useElementSize(); | |
useEffect(() => table.setIntrinsicAvailableWidth(width), [table, width]); | |
return ( | |
<div {...props} ref={ref}> | |
{table.getState().intrinsicAvailableWidth === 0 ? null : children} |
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
/** | |
* If you have a volume input (0 to 1), such as a slider, use this to convert | |
* it to a logarithmic volume that is closer to human perception (0 to 1). | |
* | |
* A more robust approach would use a Fletcher-Munson curve, however this is a | |
* close enough approximation for most use cases. | |
* | |
* You can customize the curve to your liking, generally 3-4 is a good value. | |
* | |
* The inverse of this function is {@link convertVolumeToInput}. |
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
/** | |
* @link https://raw.githubusercontent.com/NaturalCycles/js-lib/master/src/promise/pProps.ts | |
* Promise.all for Object instead of Array. | |
* | |
* Inspired by Bluebird Promise.props() and https://github.com/sindresorhus/p-props | |
* | |
* Improvements: | |
* | |
* - Exported as { promiseProps }, so IDE auto-completion works |
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 { | |
Box, | |
Button, | |
Heading, | |
HStack, | |
Input, | |
InputGroup, | |
InputRightElement, | |
Popover, | |
PopoverBody, |
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
html { | |
--max-width: 1200px; | |
--columns: 6; | |
--gutter: 1.5rem; | |
} | |
* { | |
--grid: minmax(var(--gutter), 1fr) | |
repeat( | |
var(--columns), | |
minmax( |
The package that linked you here is now pure ESM. It cannot be require()
'd from CommonJS.
This means you have the following choices:
- Use ESM yourself. (preferred)
Useimport foo from 'foo'
instead ofconst foo = require('foo')
to import the package. You also need to put"type": "module"
in your package.json and more. Follow the below guide. - If the package is used in an async context, you could use
await import(…)
from CommonJS instead ofrequire(…)
. - Stay on the existing version of the package until you can move to ESM.
This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
NewerOlder