This file contains hidden or 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 | |
# Bash completion for `up` <http://brettterpstra.com/2014/05/14/up-fuzzy-navigation-up-a-directory-tree/> | |
_up_complete() | |
{ | |
local rx | |
local token=${COMP_WORDS[$COMP_CWORD]} | |
local IFS=$'\t' | |
local words=$(dirname `pwd` | tr / " ") | |
local nocasematchWasOff=0 |
This file contains hidden or 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
# inspired by `bd`: https://github.com/vigneshwaranr/bd | |
function _up() { | |
local rx updir | |
rx=$(ruby -e "print '$1'.gsub(/\s+/,'').split('').join('.*?')") | |
updir=`echo $PWD | ruby -e "print STDIN.read.sub(/(.*\/${rx}[^\/]*\/).*/i,'\1')"` | |
echo -n "$updir" | |
} | |
function up() { | |
if [ $# -eq 0 ]; then |
This file contains hidden or 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 | |
__lower() { | |
echo "$@"|tr "[:upper:]" "[:lower:]" | |
} | |
__menu() { | |
local result="" | |
PS3=$1 | |
shift |
This file contains hidden or 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 | |
require 'yaml' | |
require 'fileutils' | |
class Folderize | |
def initialize(config_file=false) | |
config_file = File.expand_path("~/.folderize") unless config_file | |
# Set up config | |
unless File.exists?(config_file) |
This file contains hidden or 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 'shellwords' | |
query = ARGV.length > 0 ? ARGV.join(" ") : "date:today" | |
files = %x{mdfind '#{ARGV.join(" ")}'}.split("\n")[0..100] | |
filehash = {} | |
files.each {|file| | |
base = File.basename(file) |
This file contains hidden or 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 | |
decimal = "." | |
separator = "," | |
if RUBY_VERSION.to_f > 1.9 | |
Encoding.default_external = Encoding::UTF_8 | |
Encoding.default_internal = Encoding::UTF_8 | |
input = STDIN.read.force_encoding('utf-8') | |
else |
This file contains hidden or 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
_doing() | |
{ | |
local cur=${COMP_WORDS[COMP_CWORD]} | |
COMPREPLY=( $(compgen -W "$(doing help -c)" -- $cur) ) | |
} | |
complete -F _doing doing |
This file contains hidden or 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
(* Instant Search for LaunchBar by Brett Terpstra | |
Requires SearchLink installed in ~/Library/Services (http://brettterpstra.com/projects/searchlink/) | |
Load the service in LaunchBar and type Space. Enter text, optionally starting with a SearchLink !arg | |
to define the desired search engine. (You do not need the "!!" at the end to specify only url). | |
The link will be returned, pressing Enter will open it. ⌘C will copy. | |
*) | |
on handle_string(message) | |
set _chars to reverse of characters of message |
This file contains hidden or 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
# Title: Simple Image tag for Jekyll | |
# Authors: Brandon Mathis http://brandonmathis.com | |
# Felix Schäfer, Frederic Hemberger | |
# Description: Easily output images with optional class names, width, height, title and alt attributes | |
# | |
# Syntax {% img [class name(s)] [http[s]:/]/path/to/image [width [height]] [title text | "title text" ["alt text"]] %} | |
# | |
# Examples: | |
# {% img /images/ninja.png Ninja Attack! %} | |
# {% img left half http://site.com/images/ninja.png Ninja Attack! %} |
This file contains hidden or 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
tell application "Together 3" | |
set _sel to selected items | |
repeat with _note in _sel | |
set _file to original filename of _note | |
tell application "Marked" to open POSIX path of _file | |
end repeat | |
end tell |