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
javascript:navigator.clipboard.write([new ClipboardItem({ ["text/html"]: new Blob([`---<br />created: "${new Date().toISOString()}"<br />published: "${document.querySelector('time').dateTime}"<br />authors: ${document.querySelector('a[rel="author"]').text}<br />url: ${window.location}<br /><br />---<br /><br /># ${document.querySelector('link[type="application/json+oembed"]').title} <br /><br />` + document.querySelectorAll(`[data-id="${window.location.pathname.match(/(\d+)/)[1]}"] article > div`)[0].outerHTML.replace(/srcset="(.*?)"/g, (matcher,p1) => { const last = p1.split(/\s*,\s*/).pop(); return `src="${last.split(/\s+/)[0]}"`})], {type: 'text/html'})})]).then(() => console.log('Copied to clipboard')); |
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 | |
# Source: https://www.baeldung.com/linux/bash-expand-relative-path | |
resolve_relative_path() ( | |
# If the path is a directory, we just need to 'cd' into it and print the new path. | |
if [ -d "$1" ]; then | |
cd "$1" || return 1 | |
pwd | |
# If the path points to anything else, like a file or FIFO | |
elif [ -e "$1" ]; then |
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 GistTransformer = { | |
name: 'Gist', | |
shouldTransform(url) { | |
const {host} = new URL(url); | |
return ['gist.github.com'].includes(host); | |
}, | |
getHTML(link) { | |
const url = new URL(link); | |
const id = url.pathname.split('/').pop(); |
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 this | |
const modifyToken = require('markdown-it-modify-token'); | |
module.exports = function (config) { | |
... | |
// Pass a custom instance of markdownIt into eleventy. | |
config.setLibrary("md", markdownIt({ | |
// html, breaks, and linkify are default options from eleventy. | |
html: true, | |
breaks: true, |
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 default function ShowNotes({ transcript, seekTo }) { | |
const headings = transcript.filter((entry) => 'heading' in entry && entry.heading); | |
return ( | |
<ul> | |
{headings.map((heading, ix) => | |
<li | |
key={`timeline-${ix}`} | |
role="button" | |
data-start={heading.start} |
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
// https://github.com/benhoneywill/stoic-quotes | |
async function daily_stoic() { | |
const res = await fetch(`https://stoic-quotes.com/api/quote`); | |
const body = await res.json(); | |
return `> [!quote] Daily Stoic\n> ${body.text}\n> — ${body.author}`; | |
} | |
module.exports = daily_stoic; |
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
// Requested fix for https://github.com/supabase/gotrue/issues/1290 | |
export async function middleware(req: NextRequest) { | |
const res = NextResponse.next(); | |
const supabase = createMiddlewareClient({req, res}); | |
const {error} = await supabase.auth.getSession(); | |
// Trying to fix "Invalid Refresh Token: Already Used" |
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
// File: lib/collections/categories.js | |
const slugify = require("slugify"); | |
const getAllKeyValues = require("../utils/getAllKeyValues"); | |
module.exports = (collection) => { | |
let allCategories = getAllKeyValues( | |
collection.getFilteredByGlob("src/posts/**/*.md"), | |
"categories" |
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 {NextRequest, NextResponse} from 'next/server' | |
export async function middleware(req: NextRequest) { | |
const requestHeaders = new Headers(req.headers) | |
requestHeaders.set('x-request-url', req.url); | |
const res = NextResponse.next({ | |
request: { | |
headers: requestHeaders | |
} |
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
# Warning: This is not a complete script. | |
# You may also need to edit the transcript text to fix speaker names | |
# and make minor corrections before importing into Descript. | |
cat deepgram.json | jq -r ' | |
.results.channels[0].alternatives[0].paragraphs.paragraphs[] | |
| ("SPEAKER_" + (.speaker|tostring)) + ": " | |
+ ([.sentences[].text] | join(" "))' > transcript.txt |
NewerOlder