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 / grab links.bookmarklet
Last active February 20, 2025 09:55
Create a bookmark and paste the code from `grab links.bookmarklet` into the url. Trigger it on a page containing links you want to save and then click the section of the page containing the links. A Markdown list of all links will be generated, and clicking the resulting list will select all for copying.
@ttscoff
ttscoff / customthumbs.sh
Created July 4, 2013 03:48
Create custom thumbnail icons from a file's Quick Look preview on OS X
#!/bin/bash
target=$1
filename=`basename $1`
image="${TMPDIR}${filename}.png"
rsrc="${TMPDIR}icn.rsrc"
# Create a thumbnail from the file preview
qlmanage -t -s 512 -o ${TMPDIR} $target
@ttscoff
ttscoff / a_lazy_youtube_tag.rb
Last active February 20, 2025 09:55
My current setup for embedding YouTube videos in Jekyll. Responsive layout, poster image first/click to load for faster page loads.Provides a `{% youtube VIDEOID 800 600 "optional caption" %}` tag that generates the markup needed for the CSS and jQuery script.
# Title: Responsive Lazy Load YouTube embed tag for Jekyll
# Author: Brett Terpstra <http://brettterpstra.com>
# Description: Output a styled element for onClick replacement with responsive layout
#
# Syntax {% youtube video_id [width height] ["Caption"] %}
#
# Example:
# {% youtube B4g4zTF5lDo 480 360 %}
# {% youtube http://youtu.be/2NI27q3xNyI %}
@craigeley
craigeley / log-completed-reminders-to-day-one.applescript
Last active May 2, 2023 17:13
An applescript that looks for Reminders completed today and then pushes them to an entry in the Day One journal app.
--Log Completed Reminders to Day One
--by Craig Eley (@craigeley), based on scripts by Samantha Hilton and Nick Morris
--This script looks for Reminders that were completed today, then automatically sends them to a single Day One entry using the Day One [CLI Tool](http://dayoneapp.com/tools/).
--Schedule it to run at 11:55 every night using Lingon or launchd and forget about it
tell application "Reminders"
set output to ""
set output to output & "# Things done on " & date string of (current date) & linefeed
@ttscoff
ttscoff / Bullseye.bookmarklet
Last active February 20, 2025 09:55
A bookmarklet for grabbing just a piece of a web page and converting it to Markdown using heckyesmarkdown.com.
javascript:(function(){var p=document.createElement("p");p.innerHTML="<strong>Loading&hellip;</strong>";p.id="loadingp";p.style.padding="20px";p.style.background="#fff";p.style.left="20px";p.style.top=0;p.style.position="fixed";p.style.zIndex="9999999";p.style.opacity=".85";document.body.appendChild(p);document.body.appendChild(document.createElement("script")).src="https://cdn.rawgit.com/ttscoff/6109434/raw/Bullseye.js?x="+(Math.random());})();
javascript:(function(){var p=document.createElement("p");p.innerHTML="<strong>Loading&hellip;</strong>";p.id="loadingp";p.style.padding="20px";p.style.background="#fff";p.style.left="20px";p.style.top=0;p.style.position="fixed";p.style.zIndex="9999999";p.style.opacity=".85";document.body.appendChild(p);document.body.appendChild(document.createElement("script")).src="https://gist.github.com/queuebit/6118987/raw/SelectBullseye.js?x="+(Math.random());})();
@ttscoff
ttscoff / mmoutline2md.rb
Created August 22, 2013 14:37
Convert a Mindjet MindManager text outline export to Markdown
#!/usr/bin/env ruby
input = STDIN.read
input.gsub!(/^\=+\n ?(.*?)\n\=+/,"# \\1")
input.gsub!(/^-+\n\d+ (.*?)\n-+/,"## \\1")
input.gsub!(/^\d+\.\d+ (.*)/,"### \\1")
input.gsub!(/^\d+\.\d+\./,"@")
input.gsub!(/^@\d+ /,"- ")
input.gsub!(/^@\d+\.\d+ /,"\t- ")
@ttscoff
ttscoff / curio2md.rb
Created August 24, 2013 09:32
Quick conversion to Markdown for Curio list text output (Copy As Plain Text)
#!/usr/bin/ruby
# encoding: utf-8
# Quick conversion to Markdown for Curio list text output (Copy As Plain Text)
# Separates notes into subparagraphs, builds headers and lists based on max_headers setting
# You can insert a line at the top with "max headers: 5" to override the default setting for that text
# Usage:
# pbpaste|curio2md.rb > markdown_file.md
# Also works as a system service
max_headers = 3
@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 / 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