Skip to content

Instantly share code, notes, and snippets.


David Miller davidfmiller

View GitHub Profile
davidfmiller / BBEdit → LaunchBar
Last active Jan 25, 2017
Send current BBEdit document to LaunchBar
View BBEdit → LaunchBar
tell application "BBEdit"
set mydoc to (URL of document 1 of window 1) as POSIX file
end tell
tell application "LaunchBar"
open mydoc
end tell
on error
end try
davidfmiller / BBEdit Close Others.applescript
Last active Apr 7, 2017
Close Other Documents in Window
View BBEdit Close Others.applescript
tell application "BBEdit"
set mywindow to window 1
set mydoc to (URL of document 1 of mywindow) as POSIX file
set alldocs to documents of mywindow
repeat with doc in alldocs
if ((((URL of doc) as POSIX file) as string) is equal to (mydoc as string)) then
-- active doc
davidfmiller / jshint-bbedit.applescript
Last active Apr 26, 2017
Pipe `jshint` output of BBEdit's current document into a BBEdit results window
View jshint-bbedit.applescript
(* *)
tell application "BBEdit"
set mydoc to file of (document 1 of window 1)
end tell
set posixPath to POSIX path of mydoc
if (posixPath ends with ".js" or posixPath ends with ".json") then
set cmd to "/usr/local/bin/node /usr/local/bin/jshint " & (quoted form of POSIX path of mydoc) & " | /usr/local/bin/bbresults -e --pattern '(?P<file>.+?):\\sline\\s(?P<line>\\d+),\\scol\\s((?P<col>\\d+),)?\\s+(?P<msg>.*)$'"
do shell script cmd
end if
View element-scrollto.js
Smoothly scroll an element into the browser viewport
@param element {HTMLElement} - the element that which should be scrolled into the viewport
@param duration {Integer} - # of milliseconds the animation should take to complete
var scroll = function (selector, duration) {
offset = function(element) {

Keybase proof

I hereby claim:

  • I am davidfmiller on github.
  • I am davidfmiller ( on keybase.
  • I have a public key ASAgTW_t_wT0QgKwfHaHdKfDho9YtpploXBeIIKgRckrzAo

To claim this, I am signing this object:

View NSXMLNode+StringForXPath.m
#import "NSXMLNode+StringForXPath.h"
@implementation NSXMLNode (StringForXPath)
- (NSString *) stringForXPath:(NSString*)xpath
NSError *error;
NSArray *nodes = [self nodesForXPath:xpath error:&error];
if (error || nodes.count == 0)
davidfmiller / safari-bbedit.appleScript
Last active Jul 5, 2017
Open source of current Safari document in BBEdit
View safari-bbedit.appleScript
Open source of current Safari document in BBEdit
David Miller
set mycontents to ""
set myname to ""
# Get your brand new Mac setup properly
# show full path in Finder title bar
defaults write _FXShowPosixPathInTitle -bool true; killall Finder
# show hidden files in Finder
defaults write AppleShowAllFiles YES
killall Finder
davidfmiller / bbedit-documents-clipboard.applescript
Last active Nov 24, 2017
Copy text document paths in the active BBEdit window to clipboard
View bbedit-documents-clipboard.applescript
Copy paths of all open text documents in the active BBEdit window to your clipboard
tell application "BBEdit"
set mydocs to every text document in window 1
set urls to ""
repeat with doc in mydocs
set myurl to (URL of doc)
if (myurl is not missing value) then
You can’t perform that action at this time.