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
export MARKPATH="$HOME/.marks" | |
function jump { | |
cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1" | |
} | |
function mark { | |
mkdir -p "$MARKPATH"; | |
ln -s "$(pwd)" "$MARKPATH/$1" | |
} | |
function unmark { |
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
/* | |
* Tiny tokenizer | |
* | |
* - Accepts a subject string and an object of regular expressions for parsing | |
* - Returns an array of token objects | |
* | |
* tokenize('this is text.', { word:/\w+/, whitespace:/\s+/, punctuation:/[^\w\s]/ }, 'invalid'); | |
* result => [{ token="this", type="word" },{ token=" ", type="whitespace" }, Object { token="is", type="word" }, ... ] | |
* | |
*/ |
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
on alfred_script(q) | |
# set q to text returned of (display dialog "q" default answer "") | |
# (the above line can be uncommented if you want to use the script as an application or something similar) | |
if q is "read" then | |
# read file | |
tell application "Finder" | |
set ffile to selection as text | |
set ffile to quoted form of POSIX path of ffile | |
set the clipboard to (do shell script "cat " & ffile) | |
end tell |
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
tell application "Finder" | |
set FoldName to selection as text | |
set FoldName to POSIX path of FoldName | |
set newfile to text returned of (display dialog "Enter file name and extension" default answer "") | |
set FileName to FoldName & newfile | |
set FileName to POSIX path of FileName | |
set FileName to quoted form of FileName | |
do shell script "touch " & FileName | |
do shell script "open " & FileName | |
end tell |
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
set newnote to display dialog "Create a NV note" default answer "" | |
set newnote to text returned of newnote | |
tell application "Finder" to set the clipboard to newnote as text | |
tell application "Notational Velocity" | |
activate | |
tell application "System Events" | |
key code 9 using {command down, shift down} | |
key code 124 using command down | |
key code 36 | |
key code 36 |
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
tell application "System Events" | |
set w1 to the name of first application process whose frontmost is true | |
tell w1 | |
tell application "System Events" | |
key code 0 using command down | |
key code 8 using command down | |
set bodytext to the clipboard | |
set the clipboard to bodytext as string | |
tell application "Notational Velocity" | |
activate |
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
set _Path to "<<enter path to your script folder here>>" | |
set scriptLaunch to text returned of (display dialog "Enter name of script to run" default answer "" buttons "OK" default button "OK") | |
if scriptLaunch contains "" then | |
error number -128 | |
else if scriptLaunch contains scriptLaunch then | |
try | |
set scriptRun to _Path & "/" & scriptLaunch & ".scpt" | |
run script scriptRun | |
on error | |
display alert "Your script failed to launch." |
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
on run {input} | |
# this script handles cancellations properly, but is much slower than the shell script version | |
try | |
set bloog to (choose from list {"double-quote \"\"", "single-quote ''", "parenthesis ()", "curly-brace {}", "brace []", "angled-bracket <>"} with title "Select an Item" OK button name "Wrap" default items {"double-quote"} with empty selection allowed) | |
if bloog is false then | |
error number -128 | |
end if | |
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
tell application "Finder" | |
close every window | |
tell application "Notational Velocity" | |
activate | |
tell application "System Events" | |
key code 15 using shift down & command down | |
tell application "Finder" | |
delay 0.25 | |
set TaskP to selection as text | |
set TaskP to quoted form of POSIX path of TaskP |
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
# documenting because it took a while to figure out | |
function dialogbox () { | |
osascript <<EOT | |
tell application "Finder" | |
activate | |
set nameentry to text returned of (display dialog "Hello, what is your name?" default answer "") | |
end tell | |
EOT | |
} |
NewerOlder