Skip to content

March 22, 2023

Things from March 22, 2023

Bram Adams
Bram Adams
2 min read
March 22, 2023

Table of Contents

  • codex being deprecated, meaning im switching over my entire stenography stack to turbo (~exhausting!~)
https://bram-adams.ghost.io/content/images/2023/03/blue-lock-day-off-1.png
blue lock day off 1.png
https://bram-adams.ghost.io/content/images/2023/03/blue-lock-day-off-2.png
blue lock day off 2.png

*these blue lock guys make me wanna try harder at life, yah? -- to burn with raw competitive egotism for my chosen art form*

https://bram-adams.ghost.io/content/images/2023/03/c(arouse)l.png
c(arouse)l.png
https://bram-adams.ghost.io/content/images/2023/03/sunny-beach!.png
sunny beach!.png

bramadams.dev is a reader-supported published Zettelkasten. Both free and paid subscriptions are available. If you want to support my work, the best way is by taking out a paid subscription.

a command to move an image under a link to attachments folder (good for published bhovs!)

this.addCommand({
			id: "move-image-under-cursor",
			name: "Move image under cursor",
			editorCallback: async (editor, view: MarkdownView) => {
				if (!view) {
					new Notice("No active view");
					return;
				}

				const cursorPos = editor.getCursor();
				const lineText = editor.getLine(cursorPos.line);
				const match = /!\[\[(.+)\]\]/.exec(lineText);

				if (!match || !match[1]) {
					console.error(
						"No valid file link found at cursor position"
					);
					return;
				}

				const fileName = match[1];

				try {
					// Get abstract representation of source file based on its path
					const sourceFilePath = `Private/Screenshots/${fileName}`;
					const sourceFile: TFile | null =
						(await this.app.vault.getAbstractFileByPath(
							sourceFilePath
						)) as TFile;

					if (!sourceFile) {
						console.error(`Could not find file ${fileName}`);
						return;
					}

					// Move/rename the file by changing its parent folder
					const newParentFolderName = "Attachments";

					this.app.fileManager.renameFile(
						sourceFile,
						`${newParentFolderName}/${sourceFile.name}`
					);

					console.log(
						`Successfully moved/renamed ${fileName} to ${newParentFolderName}/${sourceFile.name}`
					);
				} catch (error) {
					console.error(error);
				}
			},
		});
instabram

Bram Adams

writer, programmer

Comments


Related Posts

Members Public

September 23 2022

stop delivering, if you want to make money, anyway

September 23 2022
Members Public

September 22 2023

the lies we tell ourselves about ourselves

September 22 2023
Members Public

September 21 2023

i declare war!

September 21 2023