Skip to content

Instantly share code, notes, and snippets.

View ttscoff's full-sized avatar
💭
Breathing

Brett Terpstra ttscoff

💭
Breathing
View GitHub Profile
@snuggs
snuggs / .tmux.conf
Last active February 7, 2023 13:51
IDE & TMUX Configuration
############################################################################
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\
#
# Cheatsheets:
# https://devhints.io/tmux
# `property not found` issue:
@somebox
somebox / gh-like.css
Created July 14, 2011 14:55
github markdown css+script with syntax highlighting. Works with http://markedapp.com
/*
Some simple Github-like styles, with syntax highlighting CSS via Pygments.
*/
body{
font-family: helvetica, arial, freesans, clean, sans-serif;
color: #333;
background-color: #fff;
border: none;
line-height: 1.5;
margin: 2em 3em;
@mislav
mislav / stupid-json.rb
Created December 21, 2011 12:31
Stupid simple JSON parser & generator
# encoding: utf-8
#
## Stupid small pure Ruby JSON parser & generator.
#
# Copyright © 2013 Mislav Marohnić
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this
# software and associated documentation files (the “Software”), to deal in the Software
# without restriction, including without limitation the rights to use, copy, modify,
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
@g3d
g3d / gist:2709563
Last active February 7, 2024 15:21 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan
@poritsky
poritsky / gist:4265063
Created December 12, 2012 05:22 — forked from anonymous/gist:4265059
Key commands to quickly create Markdown headers in Brett Terpstra's MarkdownEditing plugin for Sublime Text 2. ⌘^1 for #, ⌘^2 for ## and so on. Works on selected text too. Just add the following anywhere in your Default (OSX).sublime-keymap file for MarkdownEditing (or any relevant package for ST2)
{ "keys": ["super+ctrl+1"], "command": "insert_snippet", "args": {"contents": "# $0"}, "context":
[
{ "key": "setting.auto_match_enabled", "operator": "equal", "operand": true },
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
{ "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|$)", "match_all": true },
{ "key": "preceding_text", "operator": "not_regex_contains", "operand": "['a-zA-Z0-9_]$", "match_all": true },
{ "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.single", "match_all": true },
{ "key": "selector", "operator": "equal", "operand": "text.html.markdown", "match_all": true }
]
},
@dummied
dummied / metaweblog_to_nanoc.rb
Created January 10, 2013 15:58
Hacked together metaweblog api to generate posts in nanoc, circa 2009. Only bit missing was generating/uploading the relevant content. Could have also looked at reading/writing directly to the text files, but a small sql db didn't seem like a big burden at the time.
# Erik Kastner 2008-02-16 small blog engine with XMLRPC, hAtom and S3 upload (through xlmrpc) support
require 'rubygems'
require 'sinatra'
require 'xmlrpc/marshal'
require 'active_record'
require 'aws/s3'
require 'stringex'
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => "sin.db")
NANOC_DIR = "/Users/cvannoy/personal/dummied/content/blog"
@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(
@ttscoff
ttscoff / skypecall.rb
Last active December 18, 2015 04:59
Dial a phone number detected in text with Skype. Part of a [PopClip Extension](https://github.com/ttscoff/popclipextensions).
#!/usr/bin/ruby
input = ENV['POPCLIP_TEXT']
# use a regex to locate all phone numbers
phone_numbers = input.scan(/(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?/)
# send the first one to Skype via AppleScript (osascript)
%x{/usr/bin/osascript -e 'set _cmd to "CALL #{phone_numbers[0].join("")}"' -e 'tell application "Skype" to send command _cmd script name "PCDIALER"'}
@ttscoff
ttscoff / finddayone.rb
Last active December 18, 2015 05:29
Locate your Day One entries folder
#!/usr/bin/ruby
require 'shellwords'
dayonedir = %x{ls ~/Library/Mobile\\ Documents/|grep dayoneapp}.strip
full_path = File.expand_path("~/Library/Mobile\ Documents/#{dayonedir}/Documents/Journal_dayone/entries")
if File.exists?(full_path)
system "echo \"#{Shellwords.escape(full_path)}\"|tr -d '\n'|pbcopy"
puts full_path
puts "Escaped version of your Day One entries path is in your clipboard."
@muhqu
muhqu / marked
Last active December 18, 2015 19:09
#!/bin/bash
/usr/local/bin/marked "$@" \
| sed \
-e 's!\[\ \]!<input type="checkbox" onclick="return false" onkeydown="return false">!' \
-e 's!\[[.\-]\]!<input type="checkbox" onclick="return false" onkeydown="return false" indeterminate>!' \
-e 's!\[[√xX]\]!<input type="checkbox" onclick="return false" onkeydown="return false" checked>!' \
| awk '{print;if($0~/indeterminate/)found=1;}END{if(found)print "<script>window.addEventListener(\"load\",function(){var arr=document.querySelectorAll(\"input[type=checkbox][indeterminate]\");for(i in arr)arr[i].indeterminate=true;});</script>"}'