Skip to content

Instantly share code, notes, and snippets.

View brandonpittman's full-sized avatar

Brandon Pittman brandonpittman

View GitHub Profile
@brandonpittman
brandonpittman / middleman_spec_helper.rb
Created May 18, 2014 14:05
middleman spec helper
require "middleman"
require 'rspec'
require 'capybara/rspec'
Capybara.app = Middleman::Application.server.inst do
set :root, File.expand_path(File.join(File.dirname(__FILE__), '..'))
set :environment, :development
set :show_exceptions, false
end
@brandonpittman
brandonpittman / index_spec.rb
Created May 18, 2014 14:05
middleman index spec
require "spec_helper"
describe "index", :type => :feature do
before do
visit "/"
end
it "has the correct title header" do
page.should have_selector "h1"
within "h1" do
@brandonpittman
brandonpittman / vertical_centering.txt
Created May 18, 2014 14:08
Vertical center centering with a table
But if you’re using a table for this purpose (and not to display tabular-data), instead you should use another type of element (div, for example), and set its display property to table to mimick a the table behavior.
<style>
.vertical-outer {
display: table;
height: 10em
}
.vertical-inner {
@brandonpittman
brandonpittman / of_title_to_note_url.applescript
Created May 23, 2014 01:32
set OmniFocus task with video url note title
tell application "OmniFocus"
tell default document
set inbox_tasks to every inbox task
repeat with t in inbox_tasks
set t_name to (name of t) as Unicode text
set t_note to (note of t) as Unicode text
if matchResult of (find text "[w|W]atch" in t_name with regexp) exists then
set t_url to do shell script "/Users/brandonpittman/.rbenv/shims/ruby /Users/brandonpittman/Dropbox/Documents/Code/Ruby/get_url_title.rb " & t_note
set name of t to "Watch " & t_url
end if
task :default => :update
desc "Update packages"
task :update => [:rcup, :brew, :gems]
namespace :brew do
desc "Run setup Homebrew commands..."
task :setup do
sh "brew bundle Setupfile"
end
@brandonpittman
brandonpittman / rm_ds_store.sh
Created June 6, 2014 09:17
recursively delete .DS_Store files
#!/bin/bash
# This script removes all annoying .DS_Store'
s recursively from you Mac
# The first argument is the starting directory
# from: https://coderwall.com/p/oxxwca
search_folder () {
dir="$1"
if [ -d "$dir" ];then
@brandonpittman
brandonpittman / fill_pages_table_with_random_letters.applescript
Created June 23, 2014 05:56
Fill in empty word search with random letters using AppleScript
tell application "Pages"
set alphabet to "abcdefghijklmnopqrstuvwxyz"
set _table to table 1 of front document
set _cells to every cell of _table
repeat with _cell in _cells
if value of _cell = missing value then
set value of _cell to (some item of alphabet)
end if
end repeat
end tell
@brandonpittman
brandonpittman / autolink.vim
Created June 25, 2014 22:56
Upated autolink.vim
@brandonpittman
brandonpittman / night_flight.otl
Created July 1, 2014 05:05
This is me trying to convince myself to buy (**or not to buy**) a Tom Bihn Night Flight.
Night Flight
Use Cases
Personal Item on Airline
Good
20L of space
allows for lots of compartmentalization
Bad
top open flap might be a hassle
lacks good places for travel documents
Overnight Bag
@brandonpittman
brandonpittman / titlecase.vim
Created July 1, 2014 05:30
Titlecase a line in Vim
" Titlecase a line
nmap <Leader>U mm:s/\v<(\w)/\U\1/g<CR><CR>`m