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
@"(?:\\(|:\\s+)(?!http)([^\\s]+\\.(?:jpe?g|gif|png|svg|pdf))" | |
# matches local images: | |
# matches "(image.png)" | |
# matches "]: image.png" | |
# does not match remote images (http*) |
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 | |
module Bytes | |
def to_human(n,fmt=false) | |
count = 0 | |
formats = %w(B KB MB GB TB PB EB ZB YB) | |
while (fmt || n >= 1024) && count < 8 | |
n /= 1024.0 |
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 |
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/bash | |
say -v Vicki "it's pronounced gif" | |
say -v Zarvox "it's pronounced jiff" | |
while true; do | |
say -v Vicki "no, it's pronounced gif" | |
say -v Zarvox "it's pronounced jiff" | |
done |
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
# experiment with doing | |
# im planning out the book structure => @planning out the book structure | |
# im waiting for her to call me back => @waiting for her to call me back | |
# im done wishing for ponies => wishing for ponies @done() | |
# im hungry => hungry | |
im() { | |
local verb=$1 | |
shift | |
if [[ $verb =~ ing$ ]]; then |
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
for i in $(seq 53 115); do echo -ne "\r[$i]"; echo -e "\nSystematic #$i\n" >> ~/Desktop/SysPicks.md; wgrep -mq "#episode_links a:contains(PICK:)" http://5by5.tv/systematic/$i | tr -s '\n' | sed 's/PICK: //' | awk '{print "- "$0}' >> ~/Desktop/SysPicks.md; done |
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 bash | |
THEME_PROMPT_HOST='\H' | |
SCM_THEME_PROMPT_DIRTY=' 💢' | |
SCM_THEME_PROMPT_CLEAN=' 🌱' | |
SCM_THEME_PROMPT_PREFIX='[ ' | |
SCM_THEME_PROMPT_SUFFIX=' ] ' | |
export LS_COLORS='di=92:fi=0:ln=94:pi=36:so=36:bd=36:cd=95:or=34:mi=0:ex=31:*.log=1;30:*.txt=34:*.mmd=34:*.markdown=34:*.md=01;34:*.scpt=7:*.rb=35:*.tgz=93:*.gz=93:*.zip=93:*.dmg=93:*.pkg=93:*.taskpaper=95;1:*.pdf=96:*.jpg=33:*.png=33:*.gif=33:*.svg=33' | |
GIT_THEME_PROMPT_DIRTY=' 💢' | |
GIT_THEME_PROMPT_CLEAN=' 🌱' |
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 | |
=begin | |
# ezsnippets | |
Brett Terpstra 2014, MIT License | |
Based on a great idea by Stephen Margheim <http://twitter.com/s_margheim> | |
- http://www.alfredforum.com/topic/4680-snippets-on-the-fly-text-expansion/ | |
- https://github.com/smargh/alfred_snippets |
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 | |
require 'rubygems' | |
require 'forecast_io' | |
ForecastIO.api_key = 'xxxxxxxxxxxx' | |
forecast = ForecastIO.forecast(44.047889,-91.640439) | |
if ARGV[0] == "current" | |
print "#{forecast.currently.temperature.round}, #{forecast.currently.summary}" |
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
# [Create and] open project todo | |
# If you don't pass a name as an argument, it's pulled from the directory name | |
td() { | |
if [[ -n $1 ]]; then | |
proj=$1 | |
todofile=$proj.taskpaper | |
else | |
proj=${PWD##*/} | |
todofile=$proj.taskpaper | |
fi |