Skip to content

Instantly share code, notes, and snippets.

View TfTHacker's full-sized avatar

TfTHacker

View GitHub Profile
@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 -----------------*/
@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 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()
// 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
// 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 / WeekdayWeekendForTemplater
Created October 17, 2021 08:29
Weekday/Weekend for templater
<%*
window.fileDate = app.plugins.getPlugin('nldates-obsidian').parseDate(tp.file.title).moment;
window.fileDate = window.fileDate.isValid() ? window.fileDate : moment();
if ( [1,2,3,4,5].includes(fileDate.day()) ) { %>
Weekday
<%* } else if( [0,6].includes(fileDate.day())) { %>
Weekend
<%* } %>
@TfTHacker
TfTHacker / dayofweek
Created October 17, 2021 08:06
Day of Week with templater
<%*
window.fileDate = app.plugins.getPlugin('nldates-obsidian').parseDate(tp.file.title).moment;
window.fileDate = window.fileDate.isValid() ? window.fileDate : moment();
if(fileDate.day()==0) { %>
Sunday
<%* } else if(fileDate.day()==1) { %>- <%'['%> ]
Monday
<%* } else if(fileDate.day()==2) { %>- <%'['%> ]
Tuesday
<%* } else if(fileDate.day()==3) { %>- <%'['%> ]
@TfTHacker
TfTHacker / launch-resources-via-command-palette.js
Created April 17, 2022 15:15
Launch web resources via command palette
<%*
/*
Templater script to add commands to the command palette to quickly launch web resources
Brought to you by TfT Hacker (https://twitter.com/TfTHacker)
Last update: 2022-04-17
Instructions:
To add a site:
Add a new line with the title of the site and the url to the web page.
@TfTHacker
TfTHacker / vs-code-open-current-file.js
Created September 24, 2022 12:54
Create Ribbon and Command Palette commands to open Visual Studio Code
<%*
//
// Script adds a ribbon button and command in the Command palette to open the current document in VS CODE
//
// Install:
// 1. Add this text to a markdown file in your Templater "templates" folder
// 2. In templater settings, add the file you created in step 1 to the Startup section of Templater Settings
// 4. Restart Obisidan. Now the command should be available in the command palette
//