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 |
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 could update the hardcoded values, but practically, it will need to | |
# be modified to programmatically process your source files and append the | |
# result to the autoEdit transcripts.json array. | |
# This is the internal autoEdit project ID. | |
# Once you've created the project in autoEdit you can get the ID from | |
# /path/to/digital-paper-edit-electron/db/projects.json | |
# on macOS this is /Users/username/Library/Application Support/digital-paper-edit-electron | |
project_id="1234567890" |
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
// Don't do this. This is awful. | |
// Documenting it because it works, but stinks to hell. | |
Blah.play = async () => { | |
const actionListener = jest.fn(); | |
// Listen for events that log to the Actions tab. | |
const channel = addons.getChannel(); | |
channel.addListener("storybook/actions/action-event", actionListener); |
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 { documentToReactComponents } from '@contentful/rich-text-react-renderer'; | |
import { graphql } from 'gatsby'; | |
import React from 'react'; | |
// Custom renderer for embedded content which accepts `body` / `references` from the graphql query. | |
// Search `references` for the embedded object ID for full access to nested content. | |
const rendererOptions = (references) => ({ | |
renderNode: { | |
[BLOCKS.EMBEDDED_ASSET]: (node) => { | |
const imageID = node.data.target.sys.id; |
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 | |
# Check out STEAM Powered (https://steampoweredshow.com/) where I have conversations | |
# with women in STEAM to learn a bit about what they do and who they are. | |
# https://steampoweredshow.com/learn-more/ | |
# Usage | |
# ===== | |
# | |
# Execute script in the directory containing the video and srts files, or modify to take |
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 visit = require(`unist-util-visit`); | |
const remove = require(`unist-util-remove`); | |
const HTMLParser = require('node-html-parser'); | |
const matches = (classes, value) => { | |
const fragment = HTMLParser.parse(value); | |
if (!fragment.firstChild.classList) { | |
return false; | |
} |
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 config is for development use only. | |
# | |
# It was created using https://slurm.schedmd.com/configurator.html and modified | |
# enough for use on Docker kaldiasr/kaldi with slurm 16.05.9-1+deb9u. | |
# | |
# slurm < 20.02.7 is no longer available due to a security vulnerability. | |
# See: https://www.schedmd.com/archives.php | |
# Get the latest version and use the configurator from there. | |
### |
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
# Source: https://github.com/yourlabs/django-autocomplete-light/blob/master/test_project/select2_generic_foreign_key/admin.py | |
import json | |
from django.contrib import admin | |
from django.contrib.admin.options import IS_POPUP_VAR, TO_FIELD_VAR | |
from django.contrib.contenttypes.models import ContentType | |
from django.template.response import TemplateResponse | |
from .forms import TForm |