Skip to content

Instantly share code, notes, and snippets.

@jdpilgrim
jdpilgrim / Calendar-top tnow
Created December 14, 2022 19:10
Obsidian template for a calendar entry with the current time
<%*
let originalTitle = tp.file.title
title = await tp.system.prompt("Title");
await tp.file.rename(`${originalTitle} ${title}`);
tR += "---"
%>
title: <%* tR += `${title}` %>
allDay: false
date: <% tp.file.creation_date("YYYY-MM-DD") %>
startTime: <% tp.file.creation_date("HH:mm") %>
@jdpilgrim
jdpilgrim / parse title for date.md
Created December 6, 2022 16:02
obsidian templater parse out date at start of title

<%* let parsed = moment(tp.file.title.slice(0, 10)); parsed.isValid(); if(parsed.isValid()) { tR += parsed.format("YYYY-MM-DD"); } else{ tR += "no date" } %>

@jdpilgrim
jdpilgrim / Tasks within this note.md
Created December 5, 2022 17:24
Obsidian tasks within this note
function callout(text, type) {
    const allText = `> [!${type}]\n` + text;
    const lines = allText.split('\n');
    return lines.join('\n> ') + '\n'
}

const query = `
not done
---
title: <% tp.file.title %>
allDay: false
date: <% tp.file.creation_date("YYYY-MM-DD") %>
startTime: <% tp.file.creation_date("HH:mm") %>
endTime: <% tp.file.creation_date("HH:mm") %>
completed: null
tags: []
---
@jdpilgrim
jdpilgrim / Action-top tnow
Created December 5, 2022 17:21
Obsidian top matter for actions. Asks for a title
<%*
let originalTitle = tp.file.title
if (originalTitle.startsWith("Untitled")) {
originalTitle = tp.file.creation_date("YYYY-MM-DD")
}
title = await tp.system.prompt("Title");
await tp.file.rename(`${originalTitle} ${title}`);
tR += "---"
%>
title: <%* tR += `${title}` %>
@jdpilgrim
jdpilgrim / calendar-top.md
Created December 2, 2022 08:28
Obsidian templater calendar topmatter template
title allDay date completed tags
<% tp.file.title %>
true
<% tp.date.now() %>
@jdpilgrim
jdpilgrim / move-file-to-subfolder-with-same-name.js
Last active November 30, 2022 10:34
Obsidian QuickAdd script to copy a file into a sub folder with the same name. Handly to use with folder note plugin.
module.exports = async function moveFilesWithTag(params) {
const {
app,
quickAddApi: { suggester, yesNoPrompt },
} = params;
/* ... */
const { workspace, vault } = this.app;
@jdpilgrim
jdpilgrim / DeepEnumerateReferences
Last active August 29, 2015 14:21
Does a recursive search of all references (dependant dlls). Invoking main with arg[0]=ROOT will search all deep dependancies of ROOT and print those in the same directory as ROOT
using System;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
public class MyTree<K, V> : Dictionary<K, MyTree<K, V>>
{
public V Value { get; set; }
@jdpilgrim
jdpilgrim / OutlookNotificationsToPushBullet
Created March 27, 2015 16:35
Outlook macro to push notifications to android devices using PushBullet
'You need to paste it into the code file called "ThisOutlookSession".
'IMPORTANT You'll need to change the text YOUR_ACCESS_TOKEN to your Access Token that you
'you got from https://www.pushbullet.com/account
Const vbDoubleQuote As String = """" 'represents 1 double quote (")
Const vbSingleQuote As String = "'" 'represents 1 single quote (')
Private Sub Application_Reminder(ByVal Item As Object)
Dim Title As String
Dim Body As String