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 / editor.sh
Last active February 20, 2025 09:57
A replacement EDITOR variable for using different editors based on filetypes
#!/bin/bash
case "$1" in
*_EDITMSG|*MERGE_MSG|*_TAGMSG )
/usr/local/bin/vim "$1"
;;
*.md )
/usr/local/bin/mmdc "$1"
;;
*.txt )
@ttscoff
ttscoff / everwatch.rb
Created April 6, 2013 18:48
New version of EverWatch for integrating Marked with Evernote
#!/usr/bin/env ruby
# everwatch.rb by Brett Terpstra, 2011
# http://brettterpstra.com/2011/11/14/marked-scripts-nvalt-evernote-marsedit-scrivener/
# http://support.markedapp.com/kb/how-to-tips-and-tricks/marked-bonus-pack-scripts-commands-and-bundles
# Updated for latest Evernote configuration (2013) and quick launch of Marked.app - spetschu
#
# Watch Evernote for updates and put the current content of the editor into a preview file for Marked.app
# <http://markedapp.com>
require 'shellwords'
@ttscoff
ttscoff / gauges.rb
Created April 11, 2013 20:41
OS X CLI for gaug.es stats
#!/usr/bin/ruby
require 'rubygems'
require 'json'
require 'net/https'
class KeyChain
def initialize(user=nil)
@user ||= %x{dscl . -read /Users/$(whoami)|grep "EMailAddress:"|sed 's/^EMailAddress: //'}
@host="com.brettterpstra.gauges"
@ttscoff
ttscoff / octopress_filters.rb
Created April 20, 2013 13:49
Brett's customized octopress_filters plugin
#custom filters for Octopress
require './plugins/backtick_code_block'
require './plugins/post_filters'
require './plugins/raw'
require './plugins/date'
require 'rubypants'
require 'cgi'
module OctopressFilters
include BacktickCodeBlock
@ttscoff
ttscoff / brett.rb
Created April 20, 2013 13:50
Brett's custom Jekyll filters
# encoding: utf-8
#
# Brett's misc filters
require './plugins/post_filters'
require 'fileutils'
module Jekyll
module Filters
def keyword_string(keywords)
keywords.join(" ")
@ttscoff
ttscoff / itunesicon.rb
Last active January 13, 2022 10:07
Retrieve a 512 x 512px icon for an iOS app
#!/usr/bin/ruby
# encoding: utf-8
#
# Updated 2017-10-25:
# - Defaults to large size (512)
# - If ImageMagick is installed:
# - rounds the corners (copped from @bradjasper, https://github.com/bradjasper/Download-iTunes-Icon/blob/master/itunesicon.rb)
# - replace original with rounded version, converting to png if necessary
#
# Retrieve an iOS app icon at the highest available resolution
@ttscoff
ttscoff / DefaultKeyBinding.dict
Created May 2, 2013 11:58
KeyBindings file with just TextMate-style Command-Return and Command-Shift-Return
{
// TextMate Command-Return (Command Enter)
"@\U000D" = (moveToEndOfParagraph:, insertNewline:);
// Insert blank line above paragraph (Command Shift Enter)
"@$\U000D" = (moveToBeginningOfParagraph:, moveLeft:, insertNewline:);
}
# gist is defunkt, use jist
alias gist="jist -p -c"
# private gist
alias gistp="jist -Ppo"
# jump to top level of git repo
alias gt="cd \$(git rev-parse --show-toplevel)"
Funky Boss 1:36 Beastie Boys Check Your Head Rap/Hip Hop 7
@ttscoff
ttscoff / linkstopinboard.js
Last active April 30, 2018 18:53
Get links from a selected area of a page and send them to Pinboard. Edit USERNAME and PASSWORD before using.
javascript:var user='USERNAME',pass='PASSWORD';(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.9",function($,L){$(document).ready(function(){$("div,table").on("mouseover mouseout click",function(a){a.type==="mouseover"?$(this).css({outline:"1px solid red"}):$("div,table").css({outline:"none"});if(a.type==="click"){a.preventDefault();var i,linkage=$(this).find('a');linkage.each(function(link,i){console.log($(this).attr('href'));var t=open('https://'+user+':'+pass+'@pinboard.in/add?later=yes&noui=yes&jump=close&url='+encodeURIComponent($(this).attr('href'))+'&title='+encodeURIComponent($(this).text()),'Pinboard'+i,'toolbar=no,width=100,height=100');t.blur(