Skip to content

Instantly share code, notes, and snippets.

View brandonpittman's full-sized avatar

Brandon Pittman brandonpittman

View GitHub Profile
@brandonpittman
brandonpittman / man.fish
Created August 18, 2016 01:40
Colorized man pages (fish)
func man ()
set LESS_TERMCAP_mb \e"[1;31m"
set LESS_TERMCAP_md \e"[1;31m"
set LESS_TERMCAP_me \e"[0m"
set LESS_TERMCAP_se \e"[0m"
set LESS_TERMCAP_so \e"[1;44;33m"
set LESS_TERMCAP_ue \e"[0m"
set LESS_TERMCAP_us \e"[1;32m"
command man argv
end
@brandonpittman
brandonpittman / colonizeReviewTasks.applescript
Last active June 30, 2016 07:44
Make all tasks starting with "Review" colonized.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
use O : script "omnifocus"
use OmniFocus : application "OmniFocus"
tell OmniFocus
tell default document
set reviewTasks to every flattened task whose name starts with "Review"
setColon(reviewTasks) of O
end tell
@brandonpittman
brandonpittman / oneOffRoutineTask.applescript
Created June 21, 2016 00:22
Create a one-off of a routine script for later completion
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "OmniFocus"
set theWindow to front document window of front document
set theTasks to selected trees of content of theWindow
set theValues to {}
repeat with n in theTasks
set end of theValues to value of n
@brandonpittman
brandonpittman / dracula.fish
Created June 2, 2016 11:51
Dracula colors for fish shell
set -x COMMENT 6272a4
set -x CYAN 8be9fd
set -x GREEN 50fa7b
set -x ORANGE ffb86c
set -x PINK ff79c6
set -x PURPLE bd93f9
set -x RED ff5555
set -x YELLOW f1fa8c
set -U fish_color_autosuggestion $COMMENT
@brandonpittman
brandonpittman / mcd.fish
Created May 6, 2016 07:35
mcd function (improved)
# This `mcd` function will create a new directory and then `cd` to it.
# If files are provided after the new directory, they will be `mv`ed
# into the new directory as well.
function mcd
mkdir -p $argv[1]
if test (count $argv) -gt 1
mv $argv[2..-1] $argv[1]
end
and cd $argv[1]
@brandonpittman
brandonpittman / of.fish
Created April 22, 2016 06:47
The only OmniFocus function you need for fish.
function of -d "Parse transport text"
if not test (count $argv) -gt 0
open -a OmniFocus
else
osascript -e "tell application \"OmniFocus\" to parse tasks into default document with transport text \"$argv\"" > /dev/null
tint: green "Task added to OmniFocus inbox."
return 0
end
end
@brandonpittman
brandonpittman / spamMail.js
Created April 9, 2016 05:56
Use TextExpander to generate an email address
if (Application('Safari Technology Preview').running()) {
safari = Application('Safari Technology Preview')
} else if (Application('Safari').running()) {
safari = Application('Safari')
}
_tab = safari.windows[0].currentTab()
if (_tab.url().match(/http.?:\/\/www/)) {
_url = _tab.url().split("www.")
@brandonpittman
brandonpittman / hello.cr
Created March 28, 2016 02:57
Hello world in Crystal
require "option_parser"
capitalize = false
destination = "World"
OptionParser.parse! do |parser|
parser.banner = "Usage: salute [arguments]"
parser.on("-c", "--capitalize", "Capitalizes the sallute") { capitalize = true }
parser.on("-t NAME", "--to=NAME", "Specifies the name to salute") { |name| destination = name }
parser.on("-h", "--help", "Show this help") { puts parser }
@brandonpittman
brandonpittman / vqq.textexpander
Created February 4, 2016 02:31
Dr. Bunsen's filename generator (Vim-ready version)
vim "%Y%m%d_%H%M%S_%fillpopup:name=Tokens:default=R:r:I:i:C:c%%fillpopup:name=Personal/Work:1:2%.%fillpopup:name=Area of Responsibility:default=1:2:3:4:5%_%filltext:name=Keys%.%fillpopup:name=Extension:txt:otl:default=md:%"%key:return%
@brandonpittman
brandonpittman / sqq.textexpander
Created February 4, 2016 02:30
Dr. Bunsen's filename generator (shell version)
"%Y%m%d_%H%M%S_%fillpopup:name=Tokens:default=R:r:I:i:C:c%%fillpopup:name=Personal/Work:1:2%.%fillpopup:name=Area of Responsibility:default=1:2:3:4:5%_%filltext:name=Keys%.%fillpopup:name=Extension:txt:md:default=pdf:%"