Skip to content

Instantly share code, notes, and snippets.

View TfTHacker's full-sized avatar

TfTHacker

View GitHub Profile
@TfTHacker
TfTHacker / ArchiveAndProcessNextFile.js
Last active December 4, 2023 19:17
Obsidian: Archive current file and then open next file in folder (Templater script)
<%*
/*
Updated: 9/20/2022
Author: TfTHacker
Gist: https://gist.github.com/TfTHacker
Twitter: https://twitter.com/TfTHacker
Requirements: Templater Plugin for Obsidian
Description: This script performs the following actions:
1. Moves current file to the archive folder (defined in the variable archivePath)
if archivePath is null, a folders in the vault will be presented for selection
```dataviewjs
// find dates based on format [[YYYY-MM-DD]]
const findDated = (task)=>{
if( !task.completed ) {
task.link = " " + "[[" + task.path + "|*]]";
task.date="";
const found = task.text.match(/\[\[([12]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01]))\]\]/);
if(found) task.date = moment(found[1]);
return true;
}
@TfTHacker
TfTHacker / Hypothesidian.js
Last active January 16, 2024 20:52
Hypothes.is - retrieve your annotations into Obsidian (for templater plugin)
<%*
/*
# Hypothes.idian a templater script for retrieving annotations from Hypothes.is
Dev: TfTHacker https://twitter.com/TfTHacker
# Prerequisites:
+ Templater plugin by https://github.com/SilentVoid13/Templater
+ Free Hypothes.is developer token from: https://hypothes.is/account/developer
+ This script will prompt you for his token and save it to a file called "hypothesis config.md"
+ This file store your configuration and can be located any where in your vault.
// Roam42 is a prerequisite for this code, as it uses Roam42 libraries
// Install & Config:
// Add the code from this gist to a roam/js block in your roam graph and enable it
// If you prefer foreign day names, modify the english in the Javascript below
// CSS can be customized using #roam-title-day-banner CSS selector. Example:
// .roam-title-day-banner {
// color:silver;
// }
// to exclude sidebars, change 'var includeSidebars = true;' in the code o
// var includeSidebars = false;
// Roam42 is a prerequisite for this code, as it uses Roam42 libraries
// Install & Config:
// Add the code from this gist to a roam/js block in your roam graph and enable it
// You can change the custom keys where it says Mousetrap.bind('ctrl+e)
// See for more keyboard options: https://craig.is/killing/mice
// I am on European SmartKeyboard & assigned §, which is where ESC is on most keyboards
setTimeout(()=>{
Mousetrap.bind('ctrl+e', function(event, handler) {
event.preventDefault()
@TfTHacker
TfTHacker / Customize Help menu shortcut
Created September 16, 2020 04:52
Help menu custom key assignment
setTimeout(()=>{
hotkeys('ctrl+shift+6', function(event, handler) {
event.preventDefault()
displayHelp(20000)
});
},15000)
// Roam42 is a prerequisite for this code, as it uses Roam42 libraries
// Install & Config:
// Add the code in this gist to a roam/js block in your roam graph and enable it
// change the text between quotes "" where it says let txt = "....."
// You can change the custom keys where it says hotkeys('ctrl+shift+7)
// this uses the hotkeys library, so explore more key combinations at: https://wangchujiang.com/hotkeys/
// after changing the text below, you may have to refresh Roam for it to take effect.
setTimeout(()=>{
Mousetrap.unbind('ctrl+shift+7')
@TfTHacker
TfTHacker / Roam-colored_fonts.css
Created September 13, 2020 07:09 — forked from ciceronianus/Roam-colored_fonts.css
Roam - colored bold, italics and highlight by @CatoMinor3
/*
Author:: @CatoMinor3
Version:: 2
Date:: June 14th, 2020
PayPal support: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=6AMGMUDRX29XU&source=url
How to use this? Simply write c:COLOR (see supported colors below) and follow it with
bold, italics or highlighted text.
*/
/* ---------------- Roam colors -----------------*/
// roam/js code snippet to add crossing out completed todos
// also adds the CSS classname custom-strikethrough for css mods
;(()=>{
if( typeof window.roamhacker_checkboxStrikeout != 'undefined') return;
window.roamhacker_checkboxStrikeout = {};
const scanCheckboxes = () => {
@TfTHacker
TfTHacker / Roam-UpDownBlocksShortcuts-Chromebook
Last active March 12, 2021 17:20
Roam on Chromebook - Add shortcut keys for moving blocks up and down in outline
// Enable the Move block up and down from keyboard on a Chromebook
// Use CTRL+ALT+K (move block up) and CTRL+ALT+J (move block down)
// This code is dependent on Roam42, thus the 10 second delay to
// allow roam and roam42 to initiialize key assignments can easily
// be changed. See the Mousetrap documentation for key support:
// https://craig.is/killing/mice
// ADD TO ROAM
// 1) Create new page & name it something you will remember