This is an example lil thingy wow look at me!
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
# Place this file in the folder that you want to edit, and then run `python spaces-to-dashes.py` | |
import os | |
def rename_files_and_folders(root_directory): | |
for dirpath, dirnames, filenames in os.walk(root_directory, topdown=False): | |
# Rename files | |
for filename in filenames: | |
if ' ' in filename: | |
old_file_path = os.path.join(dirpath, filename) |
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
{ | |
"main": | |
[ | |
"ESC", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "BACKSPACE", | |
"PGUP", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", 127, | |
"ALT", "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "\n", | |
"SHIFT", "z", "x", "c", "v", " ", "b", "n", "m", ",", ".", "PGDN" | |
], | |
"main-shift": |
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
--- | |
let { text, posts } = Astro.props; | |
--- | |
<astro-link data-posts={posts}> | |
<a>{text}</a> | |
</astro-link> | |
<script> | |
class AstroLink extends HTMLElement { |
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
function clearInputs() { | |
let inputs = document.getElementsByTagName("input"); | |
for (const i of inputs) { | |
i.value = ""; | |
} | |
} |
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
const { BaseDirectory, exists } = window.__TAURI__.fs; | |
async function doesFileExist(fileName) { | |
let fileExists = await exists(fileName + ".pdf", { | |
baseDir: BaseDirectory.Download, | |
}); | |
let fileCounter = 0; | |
while (fileExists) { | |
fileCounter++; |
Prompt: Write a function in JavaScript that wraps a Unicode character in an HTML document in a <span>
tag with a CSS class.
Raw GPT-4 Output:
You can use the following JavaScript function to achieve this:
function wrapUnicodeCharacter(char, cssClass) {
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 mergeRefs(refs) { | |
return (value) => { | |
refs.forEach((ref) => { | |
if (typeof ref === "function") { | |
ref(value); | |
} else if (ref != null) { | |
ref.current = value; | |
} | |
}); | |
}; |
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
let url = "https://www.youtube.com/watch?v=nVvxOwxuk_w"; | |
url = url.split("v=")[1].split("&")[0]; // this removes out any extra parameters, like a playlist point etc | |
console.log(url); | |
// id = nVvxOwxuk_w |
NewerOlder