Skip to content

Instantly share code, notes, and snippets.

View dansheffler's full-sized avatar

Dan Sheffler dansheffler

View GitHub Profile
GET /packages/archive/00-index.tar.gz HTTP/1.1
Host: hackage.haskell.org
User-Agent: cabal-install/1.16.0.2
Creating new connection to hackage.haskell.org
Warning: http error: Network.Browser.request: Error raised ErrorParse "Invalid
cabal: Char.intToDigit: not a digit -1
@dansheffler
dansheffler / MyDirectoryNav.vim
Last active August 29, 2015 14:03
Vim script for walking up or down a Scrivener drafts directory (or any directory really).
function! MyDirectoryNav(direction)
let theDirectory = fnamemodify(expand('%'),':p:h') " Should be the /drafts/ directory of a Scrivener project, but will work for anything.
let thisFile = fnamemodify(expand('%'),':p') " Path to the current file.
let theFiles = split(globpath(theDirectory,'*.md'),'\n') " A list of all the .md files in the directory.
let thisIndex = index(theFiles, thisFile) " the index of the current file in this list.
if a:direction == 'j'
let nextFile = get(theFiles, thisIndex + 1, theFiles[0]) " If the direction is down, get the next file or loop to the beginning if the current file is last.
else
let nextFile = get(theFiles, thisIndex - 1, theFiles[-1]) " Likewise for going up.
endif
let s:spc = g:airline_symbols.space
function! airline#extensions#pandoc#word_count()
if mode() == "s"
return 0
else
let s:old_status = v:statusmsg
let position = getpos(".")
let s:word_count = 0
exe ":silent normal g\<c-g>"
tell application "Skim"
# Get current dimensions and font size of the currently
# selected note.
set theDocument to the front document
set filePath to the file of theDocument
set theNote to the active note of theDocument
set theBounds to the bounds of theNote
set noteWidth to the (third item of theBounds) - the (first item of theBounds)
set noteHeight to the (second item of theBounds) - the (fourth item of theBounds)
set theView to the view settings of theDocument
### McCabe - *Plato's Individuals* ###
### 2. Particulars ###
Extreme contrast between two different kinds of individuals or unities: forms, "one over many" and particulars "one under many."
[Page 25](sk://mccabe94#41)
Plato's distrust of the physical world may be ontological or it may be epistemological. Thesis: the latter because the physical world is not self-explanatory.
[Page 25](sk://mccabe94#41)
# Open BibDesk and clear any search or group selection
tell application "BibDesk"
do shell script "open -a bibdesk"
set libGroups to the library groups of the front document
set group selection of front document to libGroups
set filter field of front document to ""
end tell
# Bring the main BibDesk window to the front
set theTitle to "mybib.bib"
@dansheffler
dansheffler / myJekyll.py
Last active August 29, 2015 14:27
Quick and dirty Sublime Text 3 plugin to create a new Jekyll post.
import sublime, sublime_plugin, time
class MyJekyllCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.window().show_input_panel("Name of New Post", "", self.create_post, None, None)
def create_post(self, theTitle):
date = time.strftime("%Y-%m-%d-")
safeTitle = date + theTitle.lower().replace(" ","-")
path = "/Users/dansheffler/Dropbox/dansheffler/_posts/" + safeTitle + ".md"
@dansheffler
dansheffler / Default (Windows).sublime-keymap
Created August 11, 2015 21:25
InsertDate key command
{ "keys": ["ctrl+k", "ctrl+d"], "command": "insert_date" },
@dansheffler
dansheffler / myInsertDate.py
Last active August 29, 2015 14:27
A quick Sublime Text plugin for inserting the date at the current cursor position
import sublime, sublime_plugin, time
class insertDateCommand(sublime_plugin.TextCommand):
def run(self, edit):
date = time.strftime("%Y-%m-%d")
self.view.insert(edit, self.view.sel()[0].begin(), date)
@dansheffler
dansheffler / openTodo.py
Last active August 29, 2015 14:27
A quick and dirty Sublime Text 3 plugin for opening my todo list with a keystroke
import sublime, sublime_plugin
class openTodoCommand(sublime_plugin.TextCommand):
def run(self, edit):
path = "/Users/dansheffler/Dropbox/Tasks/todo.taskpaper"
self.view.window().open_file(path)