Skip to content

Instantly share code, notes, and snippets.

View brandonpittman's full-sized avatar

Brandon Pittman brandonpittman

View GitHub Profile
@brandonpittman
brandonpittman / remove_reminded.sh
Created February 22, 2014 10:25
Remove @REMINDED tags from nvremind
#!/bin/zsh
cd ~/Dropbox/Documents/Markdown
grep -rl '@reminded' ./ | xargs sed -i '' -E 's/@reminded.+$//g'
@brandonpittman
brandonpittman / incomplete_inbox_tasks.applescript
Created February 26, 2014 00:01
Get count of incomplete inbox tasks in OmniFocus
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 August 29, 2015 13:56
Creates a new file at location of front Finder window.
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
#!/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 April 30, 2014 00:16
Regex for matching only single digits
(?<!\d)(\d)(?!\d)
@brandonpittman
brandonpittman / keybase.md
Created May 10, 2014 04:17
keybase.io stuff

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:

@brandonpittman
brandonpittman / auto_rbenv_rehash.sh
Created May 14, 2014 23:36
Auto-rehash rbenv shims
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 23:44
Open url in OmniFocus note with Safari
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
@brandonpittman
brandonpittman / .vimrc
Last active August 29, 2015 14:01
.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
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.