Skip to content

Instantly share code, notes, and snippets.

View chaptastic's full-sized avatar

Chap Lovejoy chaptastic

View GitHub Profile
(defprotocol ReactorStateRef
(restore-state! [this]
"Restore the referenced state to the most recent snapshot if available
or to the initial state. Update the version to reflect the new state.")
(reset-state! [this]
"Reset the referenced state to the initial state. Update the version to 0.")
(apply-event! [this event version]
"Apply the supplied event to the referenced state and update the version.
Nil events are considered to be no-op and only update the version. If the
version is nil, apply the event but do not update the version.")
@chaptastic
chaptastic / mark-map.el
Created June 4, 2013 01:37
Create a prefix-key for marking text objects
;; Define a keymap for mark object commands
(define-prefix-command 'mark-object-map)
(global-set-key (kbd "C-x m") 'mark-object-map)
(define-key mark-object-map (kbd "(") 'er/mark-inside-pairs)
(define-key mark-object-map (kbd ")") 'er/mark-outside-pairs)
(define-key mark-object-map (kbd "\"") 'er/mark-inside-quotes)
(define-key mark-object-map (kbd "'") 'er/mark-outside-quotes)
(define-key mark-object-map (kbd "w") 'er/mark-word)
(define-key mark-object-map (kbd "u") 'er/mark-url)
(define-key mark-object-map (kbd "e") 'er/mark-email)
@chaptastic
chaptastic / jq_callback.js
Created December 18, 2012 17:06
jquery callback setup
$("tr").each(function() {
var container = $(this);
var add_button = container.find("a.add");
var field_container = container.find("td.fields");
add_button.click(function() {
var new_elt = $("<div>...</div>");
field_container.append(new_elt);
})
});
@chaptastic
chaptastic / gist:1127738
Created August 5, 2011 15:10
Open in Chrome for Reeder
property theURL : ""
set clipSave to the clipboard
tell application "Reeder"
activate
end tell
tell application "System Events"
keystroke "c" using {shift down, command down}
@chaptastic
chaptastic / gist:1127691
Created August 5, 2011 14:54
Address book search via AppleScript
tell application "Address Book" to activate
tell application "System Events"
keystroke "f" using command down
keystroke "search text"
end tell