Skip to content

Instantly share code, notes, and snippets.

View Quorafind's full-sized avatar
💭
Animal well

Boninall Quorafind

💭
Animal well
View GitHub Profile
@Quorafind
Quorafind / editableBlocks.js
Last active February 21, 2025 04:28
Toggle blocks in editor editable or readonly
module.exports = async params => {
// Get current active file view
const activeView = params.app.workspace.getActiveFileView()
if (!activeView) {
new Notice('No active file view found!')
return
}
// Toggle edit mode for all blocks
@Quorafind
Quorafind / config.json
Created October 30, 2024 14:57
Duplicate any templates
{
"templates": [
{
"name": "Vue3 + TypeScript",
"path": "./templates/vue3-ts",
"description": "Vue 3 项目模板,使用 TypeScript",
"version": "1.0.0"
},
{
"name": "React + TypeScript",
@Quorafind
Quorafind / main.go
Created October 28, 2024 01:19
Markdown To CSV
package main
import (
"bufio"
"encoding/csv"
"fmt"
"io"
"net/http"
"os"
"path/filepath"
@Quorafind
Quorafind / hover.ts
Last active October 14, 2024 08:01
Obsidian Jump to/Hover Specific Content
// Interface defining the options for showing content
interface ShowContentOptions {
start: number; // Starting position of the content
end: number; // Ending position of the content
content: string; // The full content string
view: MyView; // The view object
file: TFile; // The file object
plugin: MyPlugin; // The plugin instance
}
/* attempt to better vertically align block embeds in lists */
:is(.HyperMD-list-line, .markdown-rendered :is(ol, ul)) .inline-embed[src*="#^"]:has(.markdown-preview-section > div > ul:only-child) {
margin-left: 0px;
border-left: 0px;
padding-left: 0px;
& > .embed-title {
display: none;
}
@Quorafind
Quorafind / main.ts
Created July 16, 2024 15:37
Register epub file extension in Obsidian
export default class ExamplePlugin extends Plugin {
async onload() {
this.registerExtensions(["epub"], "epub");
this.registerView("epub", (leaf) => new EpubView(leaf));
}
onunload() {
}
}
@Quorafind
Quorafind / calendar.tsx
Created December 13, 2023 08:34 — forked from mjbalcueva/calendar.tsx
shadcn ui calendar custom year and month dropdown
"use client"
import * as React from "react"
import { buttonVariants } from "@/components/ui/button"
import { ScrollArea } from "@/components/ui/scroll-area"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"
import { cn } from "@/lib/utils"
import { ChevronLeft, ChevronRight } from "lucide-react"
import { DayPicker, DropdownProps } from "react-day-picker"
@Quorafind
Quorafind / CopyChatGPT.js
Created February 23, 2023 04:31
Use Quickadd to copy ChatGPT result
module.exports = {"Copy Chat History": copyChatWithHistory, "Copy Last Answer": copyLastAnswer};
const ExportMD = (function () {
if (!window.TurndownService) return;
const hljsREG = /^.*(hljs).*(language-[a-z0-9]+).*$/i;
const turndownService = new window.TurndownService({
headingStyle: "atx",
hr: "---",
bulletListMarker: "-",
codeBlockStyle: "fenced",
@Quorafind
Quorafind / AskChatGPT-With-Surfing.js
Created February 19, 2023 11:20
Using Quickadd to ask current selection In ChatGPT
// Version 0.0.1
module.exports = askChatWithPrompt;
function askChat(str, app) {
const prompt = encodeURI(str);
const chatViewEl = app.workspace.getLeavesOfType("surfing-view").find((item)=>{ return /chat\.openai\.com/.test(item?.view?.currentUrl)}).view.webviewEl;
chatViewEl.executeJavaScript(`
var htmlElement = document.querySelector("textarea");
htmlElement.value = decodeURI("${ prompt }");
@Quorafind
Quorafind / Dynamic Highlight.data.md
Last active May 13, 2024 02:50
Using dynamic highlight to highlight HH:mm/H:mm time format in Obsidian

Import data json below to dynamic highlight config.

{
  "light-time-8-5": {
    "class": "light-time-8-5",
    "color": "#E45858",
    "regex": true,
    "query": "(?<=\\s)(0?8|20):[3-5][0-9](:[0-5][0-9])?(?=(\\s|$))",
    "mark": [