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 / glog.sh
Created May 8, 2012 03:36
Bash function to add current directory to git repo list for gitlogger <https://gist.github.com/2632346>
# Add current folder to ~/.gitlogger with name specified as argument 1
# For use with gitlogger.sh
function glog () {
(echo "$1:`pwd`";grep -v "`pwd`$" ~/.gitlogger) | sort > ~/.gitlogger.tmp
mv ~/.gitlogger.tmp ~/.gitlogger
}
@ttscoff
ttscoff / gitlogger-install.rb
Created May 8, 2012 10:03
Installer for gitlogger.rb
#!/usr/bin/ruby
require 'ftools'
puts "Installing GitLogger"
puts "This script will install the following files:"
puts
puts "/usr/local/bin/gitlogger.rb"
puts "~/Library/LaunchAgents/com.brettterpstra.gitlogger.plist"
puts "It will add the glog command to your bash_profile and"
@ttscoff
ttscoff / CSSCmdEnter.sublime-keymap
Created May 17, 2012 09:44
TextMate CSS {...} on Cmd-Enter for Sublime Text 2
[
{ "keys": ["super+enter"], "command": "insert_snippet", "args": {"contents": " {\n $0\n}"}, "context":
[
{ "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }
]
}
]
@ttscoff
ttscoff / copy_scope.py
Created May 17, 2012 21:55
Copy Scope plugin for Sublime Text 2
import sublime, sublime_plugin
class CopyScopeCommand(sublime_plugin.TextCommand):
def run(self, edit):
sublime.set_clipboard(self.view.scope_name(self.view.sel()[0].begin()))
sublime.status_message("Copied scope")
def is_enabled(self):
return self.view.sel()
@ttscoff
ttscoff / brettquix.txt
Created May 23, 2012 02:32
Brett's Quix File
@Brett's searches
@Brett's custom searches
go https://duckduckgo.com/?q=%21%20%s Open first result (DuckDuckGo)
b https://duckduckgo.com/?q=%21%s Bang search (DuckDuckGo)
grep https://www.cueup.com/?q=%s&fq=1 Greplin
ss https://duckduckgo.com/site:%d%20%s Current site (DuckDuckGo)
bt https://duckduckgo.com/site:brettterpstra.com%20%s BrettTerpstra.com (DuckDuckGo)
gh http://github.com/search?q=%s&type=Everything&repo=&langOverride=&start_value=1 Search GitHub (everything)
hints http://hints.macworld.com/search.php?query=%s&keyType=all&datestart=&dateend=&topic=0&type=stories&results=50&mode=search Search Mac OS X Hints
mu http://www.macupdate.com/find/mac/%s Search MacUpdate (Software)
@ttscoff
ttscoff / ddhack.md
Created June 4, 2012 18:14
DuckDuckHack/DuckDuckGo news

This is probably posted elsewhere, but I didn't see it. Cool stuff for DuckDuckGo users, just in case you don't subscribe to the newsletter.


Dear DuckDuckGo friends,

Last month we launched DuckDuckHack, our open source platform that enables developers to create instant answer plugins on DuckDuckGo: http://duckduckhack.com/.

The following are the plugins we launched via the platform in the past few weeks.

@ttscoff
ttscoff / podcastnames.md
Created June 5, 2012 00:52
Brainstorming Names

Title brainstorming

A collection of random ideas in random order. Some mine, some from the good folks on Twitter, some mine but inspired by Twitter folk.

  • Command Control Escape
  • Look, I made you this/something
  • ALT
  • <alt.nerd>
  • Power Hour
  • Terminal Nerdery
@ttscoff
ttscoff / complete_domain.sh
Created June 16, 2012 09:51
defaults domain completion for Bash on OS X
## Bash completion for `defaults` domains
## e.g. `defaults read com.apple[TAB]`
_complete_domain ()
{
local cur
local LC_ALL='C'
cur=${COMP_WORDS[COMP_CWORD]}
cur=${cur//\./\\\.} # escape dots for grep
local IFS="
@ttscoff
ttscoff / CustomReaderGithub.css
Created June 17, 2012 11:49
Github style for the CustomReader Safari Extension
/* For use with the CustomReader Safari Extension */
/* <http://canisbos.com/customreader> */
body
{
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-box-align: center;
background: url("linen.png");
color: black;
@ttscoff
ttscoff / text_score.rb
Created June 17, 2012 16:17
Readability stats for passed text using ipeirotis.appspot.com
#!/usr/bin/env ruby
# Uses the Readability Metrics API from http://ipeirotis.appspot.com/readability-api.html
# Accepts text from STDIN (piped) or as an argument
=begin examples
pbpaste|text_score.rb # copy text and run (on OS X) to get the stats for the clipboard.
cat myfile.md|text_score.rb # get scores for the contents of a file
=end
require 'open-uri'
require 'net/http'