View gen_random_filename.bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Bash function gen_random_filename | |
# Description: Generates random two-word names | |
# Requires a dictionary file, easily generated with `aspell dump master > dictionary.txt` | |
# or grab it from https://gist.githubusercontent.com/ttscoff/55493fe89c35ec1588ba/raw/ | |
# Requires shuf (brew install coreutils) | |
# | |
# Example results: | |
# darkest_pickpockets | |
# besets_struts | |
# unzip_Malone |
View bitlyize.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# encoding: utf-8 | |
# Bitlyize by Brett Terpstra 2014 | |
# Shortens all URLs in input and automatically adds Amazon and iTunes affiliate codes | |
# A single bitly link passed to this script will return the long url | |
# This script was designed for use in an OS X System Service, but runs | |
# as a CLI and can be included as a Ruby library in other scripts | |
# | |
# The bitly_username and bitly_key variables are required | |
# Optionally configure the custom domain, and itunes and amazon affiliate variables |
View a.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Overtired 26 | |
Brett and Christina skip CES to reminisce about Mean Girls. Yeah, Taylor Swift came up, but we didn't dwell on it. We're growing. | |
From drunken, -20° snow shoveling to watching some great new movies by the fire, this is a mid-winter show that has it all. Don't they always, though? Jack of all trades, master of, well, we're pretty good at pop culture... | |
## Links | |
* [The amazing Taylor Swift mashup of the two best songs from 1989](https://www.youtube.com/watch?v=7m3o5LuFKxg&feature=youtu.be%EF%BB%BF) | |
* [Regarding the Gossip Girl and Tech Overlap](https://twitter.com/JohnLegere/status/551822878166245378%EF%BB%BF) |
View Songza Lucky Link TextMate Command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -rjcode -Ku | |
# TextMate command to get the first url | |
# from a Songza.fm search for the selected text. | |
# Input: Selected Text or Word | |
# Output: Show as Tool Tip | |
require ENV['TM_SUPPORT_PATH'] + '/lib/escape' | |
require 'open-uri' | |
require 'rubygems' | |
require 'hpricot' |
View Songza Link Selection (TextMate Command)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -rjcode -Ku | |
# TextMate Command "Songza Link" | |
# Scrapes the results of a Songza.fm search for | |
# the selected text, offers a popup menu and | |
# inserts a snippet of the selected link and title | |
# tab-stopped for easy removal of the title. | |
# Requires Rubygems and Hpricot | |
# Input: Selected Text or Word | |
# Output: Insert as Snippet |
View NerdTool RSS Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -rjcode -Ku | |
require 'rss/2.0' | |
require 'open-uri' | |
require 'time' | |
class RSSFetcher | |
RED = "\033[1;31m" | |
GREEN = "\033[32m" | |
YELLOW = "\033[33m" |
View TextMate Drag Command for Base64-encoded images in CSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Drag command set to handle: jpg,png,gif | |
# scoped to: text.html.basic source.css.embedded.html, source.css meta.scope.property-list.css | |
openssl base64 -in "$TM_DROPPED_FILE" | awk -v ext="${TM_DROPPED_FILE#*.}" '{ str1=str1 $0 }END{ print "background:url(data:image/"ext";base64,"str1");" }' |
View DefaultKeyBinding.dict
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add to (or create) ~/Library/KeyBindings/DefaultKeyBinding.dict | |
// Incorporated change by Lri to not require additional words on the line to work | |
// fixed to handle first character of list item being non-alphanumeric | |
// Issues: | |
// If there are more than one symbols ([[, ![, etc.) at the beginning of the line, anything beyond the first one is captured and added to new line | |
// FIXED: Entering more than one blank item in a row and then using ⌘Z leaves a placeholder character on the previous line. | |
{ |
View doc2mmd.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# doc2mmd.rb | |
# rough draft of a Markdown converter for .doc files | |
# requires python html2text, edit path in last shell call | |
def e_sh(str) | |
str.to_s.gsub(/(?=["\\])/, '\\') | |
end | |
ARGV.each {|f| |
View hamlet.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/shakespeare -hamlet | |
function suffer() { | |
outrageous_fortune = true; | |
return false; | |
} | |
function oppose() { | |
if (take_arms(sea_of_troubles)) sleep; | |
die; |
OlderNewer