Skip to content

Instantly share code, notes, and snippets.

View ttscoff's full-sized avatar
💭
Breathing

Brett Terpstra ttscoff

💭
Breathing
View GitHub Profile
@ttscoff
ttscoff / template.html
Last active September 14, 2016 01:25
Add this before the </body> tag in an nvALT template.html file for working [[note links]] in the preview.
<script>
window.onload = function(e){
var container = document.getElementById("wrapper");
container.innerHTML = container.innerHTML.replace(/\[\[(.*?)\]\]/g,"<a href='nvalt://find/$1'>$1</a>");
}
</script>
@ttscoff
ttscoff / template.html
Created August 25, 2013 17:42
Barebones nvALT template with [[linking]] built-in
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{%title%}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
@ttscoff
ttscoff / tags_json.html
Created August 26, 2013 20:11
For jTag. Place this is _layouts/tags_json.html
---
layout: nil
---
{
"tags_count": [{% for tag in page.json_tags_count %}
{"name":"{{tag.name}}","count":{{tag.count}}},{% endfor %}
false],
"tags": [{% for tag in page.json_tags %}
"{{tag}}",{% endfor %}
false]
@ttscoff
ttscoff / Archive Day One entries
Created August 26, 2013 20:46
Just a thought
# cd into your Journal/entries/ folder first
# completely untested. Use at your own risk.
for file in $(grep -le "date>2012" *.doentry); do mv $file /backup_folder/; done
@ttscoff
ttscoff / short_titles.sh
Created August 29, 2013 02:19
Via @pilotmoon, the secret to shortening your popclip bar.
$ defaults write com.pilotmoon.popclip UseShortTitles -bool YES
$ killall PopClip && open -a PopClip
@ttscoff
ttscoff / aliaslast.bash
Last active February 20, 2025 09:52
Alias last command in bash and save
# alias last and save
# use `als c NAME` to chop off the last argument (for filenames/patterns)
als() {
local aliasfile chop x
[[ $# == 0 ]] && echo "Name your alias" && return
if [[ $1 == "c" ]]; then
chop=true
shift
fi
aliasfile=~/.bash_it/aliases/custom.aliases.bash
@ttscoff
ttscoff / lazylink.rb
Created October 19, 2013 18:56
Marked 2 Preprocessor for "lazy links"
@ttscoff
ttscoff / randommarkdown.rb
Created October 26, 2013 20:58
Generates a ton of Lorem Ipsum Markdown text for testing/filler purposes. Easily modifiable output.
#!/usr/bin/ruby
# Generates a bunch of random Markdown text (with footnotes/tables)
# REQUIREMENTS:
# raingrams gem ([sudo] gem install raingrams)
# a text file at ~/words/alice.txt containing lots of words
# I recommend using mine from http://ckyp.us/kZWQ
require 'rubygems'
require 'raingrams'
@ttscoff
ttscoff / listtags.bash
Last active February 20, 2025 09:50
Bash function to search the current directory for files based on Mavericks tags.
# Updated 2013-10-31 to handle:
# listing all files with tags
# list only files without tags
# and deal with spaces in filenames (that part got ugly).
# Also, set the query variable to local
# List files with specified Finder tags in current directory and subdirectories
# Works with partial words starting from the beginning of the word
lst() {
@ttscoff
ttscoff / chrome2of.applescript
Created October 27, 2013 16:52
Instant list of current Chrome tabs to an OmniFocus inbox task. Based on work by Veritrope and Zettt.
(*
http://veritrope.com
Google Chrome URLs List to OmniFocus
Version 1.0
April 23, 2011
Project Status, Latest Updates, and Comments Collected at:
http://veritrope.com/code/safari-tab-list-to-omnifocus
=========
BASED ON THIS SAFARI/EVERNOTE SCRIPT:
http://veritrope.com/code/export-all-safari-tabs-to-evernote/