Skip to content

Instantly share code, notes, and snippets.

Avatar
🏕️
I’m trying to do my job, please respect my time and attention.

Brandon Pittman brandonpittman

🏕️
I’m trying to do my job, please respect my time and attention.
View GitHub Profile
View remove_reminded.sh
#!/bin/zsh
cd ~/Dropbox/Documents/Markdown
grep -rl '@reminded' ./ | xargs sed -i '' -E 's/@reminded.+$//g'
@brandonpittman
brandonpittman / incomplete_inbox_tasks.applescript
Created Feb 26, 2014
Get count of incomplete inbox tasks in OmniFocus
View incomplete_inbox_tasks.applescript
tell application "OmniFocus"
tell default document
set incomplete to every inbox task where completed is false
count incomplete
end tell
end tell
@brandonpittman
brandonpittman / new_file_at_finder_window.applescript
Last active Aug 29, 2015
Creates a new file at location of front Finder window.
View new_file_at_finder_window.applescript
tell application "Finder"
set _question to display dialog "Please enter file name..." default answer "" with title "New File"
set _file to text returned of _question
set _target to target of front window as alias
set _path to POSIX path of _target
set full_name to quoted form of _path & _file
do shell script "touch " & full_name
end tell
View railscasts.rb
#!/usr/bin/ruby
require 'rss'
# Usage
# $ ./railscasts.rb http://railscasts.com/subscriptions/YOURRAILSCASTRSS/\/
# episodes.rss
# OR
# $ ./railscasts.rb
p 'Downloading rss index'
@brandonpittman
brandonpittman / single_digits.regex
Created Apr 30, 2014
Regex for matching only single digits
View single_digits.regex
(?<!\d)(\d)(?!\d)
View keybase.md

Keybase proof

I hereby claim:

  • I am brandonpittman on github.
  • I am pittman (https://keybase.io/pittman) on keybase.
  • I have a public key whose fingerprint is 20D9 31FA 7FE2 FC1E D36A 14C9 6A43 5396 B0FE 6254

To claim this, I am signing this object:

View auto_rbenv_rehash.sh
git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash
@brandonpittman
brandonpittman / open_url_note.applescript
Created May 14, 2014
Open url in OmniFocus note with Safari
View open_url_note.applescript
tell application "OmniFocus"
tell front window
set my_sel to selected trees of content
set my_selection to value of item 1 of my_sel
set a_note to get note of my_selection
do shell script "open " & a_note
set completed of my_selection to true
end tell
end tell
View .vimrc
" Vundle Setup {{{1
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Source Vundle Plugins {{{1
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
endif
" Vundle Teardown {{{1
View middleman_blog_similar.md
gem 'middleman-blog-similar'
gem 'levenshtein-ffi', :require => 'levenshtein'
h2 Similar Entries
ul
  - similar_articles.first(5).each do|article|
    li= link_to article.title, article.url

You can retrieve similar articles from similar_articles helper method or Middleman::Blog::BlogArticle#similar_articles instance method.

Currently this extension supports similarity engines: levenshtein-ffi, levenshtein and damerau-levenshtein. However, I think those are bit low accuracy, so I’m tring to create engines with tf-idf-similarity library.