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
| export type HeadingType = { | |
| id: string; | |
| depth: number; | |
| label: string; | |
| }; | |
| export function extractHeadings(content: any): HeadingType[] { | |
| const headings: HeadingType[] = []; | |
| for (const parent of content) { |
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 { | |
| isSameDay, | |
| isSameMonth, | |
| format, | |
| } from 'date-fns'; | |
| const evaluateDateRange = ( | |
| start: Date, | |
| end: Date | |
| ): [string] | [string, string] => { |
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 { useState, useEffect } from 'react'; | |
| export function usePrefersReducedMotion() { | |
| const [prefersReducedMotion, setPrefersReducedMotion] = useState(false); | |
| useEffect(() => { | |
| if (!window.matchMedia) { | |
| setPrefersReducedMotion(false); | |
| return; | |
| } |
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
| /** | |
| * An alternative to `Object.keys()` that avoids type widening. | |
| * | |
| * @example | |
| * Object.keys({ foo: 1, bar: 2 }) // string[] | |
| * typedKeys({ foo: 1, bar: 2 }) // ("foo" | "bar")[] | |
| */ | |
| export function typedKeys<T>(obj: T) { | |
| return Object.keys(obj) as Array<keyof T>; | |
| } |
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
| for file in directory | |
| do | |
| SUBSTR=$(echo $file | cut -d' ' -f 1) | |
| SUBSTR="${SUBSTR}.csv" | |
| mv -v "${file}" $SUBSTR | |
| done |
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
| <?xml version="1.0" encoding="utf-8" standalone="no"?> | |
| <folders> | |
| <folder> | |
| <title>SCP</title> | |
| <snippets> | |
| <snippet> | |
| <title>scp from server</title> | |
| <content>scp your_username@remotehost.edu:foobar.txt /local/dir</content> | |
| </snippet> | |
| <snippet> |
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
| { | |
| "Scaffold Sanity Schema": { | |
| "prefix": "sanity schema", | |
| "body": [ | |
| "export default {", | |
| " name: '${1:${TM_FILENAME_BASE}}',", | |
| " title: '${2:${TM_FILENAME_BASE/(^[a-zA-Z])/${1:/upcase}/}}',", | |
| " type: 'document',", | |
| " fields: [", | |
| " $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
| # Logs | |
| logs | |
| *.log | |
| npm-debug.log* | |
| yarn-debug.log* | |
| yarn-error.log* | |
| # Runtime data | |
| pids | |
| *.pid |