Skip to content

Instantly share code, notes, and snippets.

View neurobashing's full-sized avatar

Gregg Thomason neurobashing

View GitHub Profile
@neurobashing
neurobashing / gist:1095041
Created July 20, 2011 14:17
Simple BBEdit Menu Script
on menuselect()
tell application "Transmit"
activate
end tell
set troof to true
return troof
end menuselect
@neurobashing
neurobashing / gist:1739315
Created February 4, 2012 18:24
get path of document
tell application "BBEdit"
set activeWindow to front window
if (class of activeWindow is project window) then
set projectDocument to project document of activeWindow
if ((count of items of projectDocument) > 0) then
set firstFileItem to item 1 of projectDocument as alias
else
set firstFileItem to file of document of activeWindow as alias
end if
@neurobashing
neurobashing / gist:1739659
Created February 4, 2012 19:36
get selected text in safari
tell application "Safari"
-- set tehWin to current tab of window 1
set selectedText to (do JavaScript "(''+getSelection())" in document 1)
end tell
@neurobashing
neurobashing / gist:1839265
Created February 15, 2012 21:56
My command line reddit reader
#!/usr/bin/env python
import urllib,json
a = urllib.urlopen('http://www.reddit.com/r/programming/.json')
try:
j = json.load(a)['data']
except KeyError:
print "Reddit sucks."
exit()
storieslist = j['children']
@neurobashing
neurobashing / Asset.txt
Created March 15, 2012 20:44
vim 'format buffer'
nnoremap <leader>ft mZggVG='Z
@neurobashing
neurobashing / gist:2174673
Created March 23, 2012 20:32
Ensure the editor view has focus when executing a Komodo JS macro
ko.views.manager.currentView.setFocus();
#!/usr/bin/env node
var http = require('http');
var options = {
host: 'www.reddit.com',
port: 80,
path: '/r/programming/.json'
}
@neurobashing
neurobashing / gist:2399314
Created April 16, 2012 15:03
BBEdit expert prefs I use
# change to NO to keep "distraction free" style, YES to have REALLY full-screen
defaults write com.barebones.bbedit FullScreenWindowsHogScreen -bool YES
# When using the "Previous Document" and "Next Document" commands on the View menu, or the
# navigation arrows in the navigation bar, the order in which BBEdit navigates documents is
# determined by the order in which they were opened. If you prefer, these commands can be
# made to navigate the documents in the order shown in the file list.
defaults write com.barebones.bbedit SurfNextPreviousInDisplayOrder -bool YES
# By default, the "Balance" command (or double-clicking on a delimiter to balance) does
@neurobashing
neurobashing / gist:2492938
Created April 25, 2012 20:05
Reddit "Browser" Script
tell application "BBEdit"
set theContent to do shell script "~/bin/reddit.py"
make new shell window with properties {contents:theContent}
end tell
@neurobashing
neurobashing / gist:2512014
Created April 27, 2012 19:18
user style to make wikipedia less annoying
#mw-panel {
display: none !important;
width: 0px;
}
#mw-head {
display: none !important;
}
#mw-head-base {
height: 0px !important;
}