Skip to content

Instantly share code, notes, and snippets.

@liamcain
liamcain / obsidian-debug-mobile.js
Last active April 22, 2024 05:57
Save console messages to logfile for mobile debugging
declare module "obsidian" {
interface App {
isMobile: boolean;
}
}
// Call this method inside your plugin's `onLoad` function
function monkeyPatchConsole(plugin: Plugin) {
if (!plugin.app.isMobile) {
return;
@liamcain
liamcain / obsidian-pagebreaks.css
Created November 8, 2020 01:04
Obsidian Pagebreaks
/**
Create pagebreaks in exported Obsidian PDFs.
Example:
# Heading 1
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
when an unknown printer took a galley of type and scrambled it to make a type
:root {
--dark0: #2e3440;
--dark1: #3b4252;
--dark2: #434c5e;
--dark3: #4c566a;
--light0: #d8dee9;
--light1: #e5e9f0;
--light2: #eceff4;
def minimum_candidate_filter(l):
s=list(map(str, l))
return [c for c in l if s==s[::-1] and c**(.5)%1==0]
print(minimum_candidate_filter([0, 1000, 121, 676]))
@liamcain
liamcain / b.py
Last active August 20, 2019 22:38
def func2() -> str:
b="shake"
g,a,c,d,o="gunna", "play", "break", "fake", f"I {b} it off"
def r(z):
return ", ".join([a]*5)
return f"""
Cause the {a}ers {g} {r(a)}
And the haters {r(b)}
Baby, I'm just {g} {r(a)}
{o}{o}
@liamcain
liamcain / a.py
Last active August 20, 2019 22:47
prob 1
def func(s) -> str:
return "".join(f"!{c}"*2 for c in s)+"!"
[
{ "caption": "-" },
{
"caption": "Fuzzy Nav",
"command": "fuzzy_file_nav",
"args": {"regex_exclude": [".*\\.(DS_Store|svn|git)$"]}
},
{
"caption": "Fuzzy Nav Here",
"command": "fuzzy_start_from_file",
@liamcain
liamcain / crashlog.txt
Created June 15, 2012 00:19
ST2 + Clangexp Crash
Process: Sublime Text 2 [11187]
Path: /Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2
Identifier: com.sublimetext.2
Version: Beta, Build 2199 (2199)
Code Type: X86-64 (Native)
Parent Process: launchd [151]
Date/Time: 2012-06-14 20:16:31.928 -0400
OS Version: Mac OS X 10.7.3 (11D50b)
Report Version: 9
@liamcain
liamcain / Refresh.tmTheme
Created January 22, 2012 15:49
Refresh: colorscheme for Sublime Text 2 or Textmate (modified from IR_Black)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Refresh</string>
<key>settings</key>
<array>
<dict>
<key>settings</key>
@liamcain
liamcain / ClozeDeletion.py
Created January 15, 2012 18:30
Cloze Deletion? on ST2???
import sublime, sublime_plugin, re
class ClozeDeletionCommand(sublime_plugin.WindowCommand):
def run(self):
self.window.show_input_panel("Cloze Deletion", "", self.on_done, self.on_change, self.on_cancel)
def on_change(self, inp):
view = self.window.active_view()
sel = view.sel()[0];