(defun sacha/copy-code-as-org-block-and-gist (beg end)
(interactive "r")
(let ((filename (file-name-base))
(mode (symbol-name major-mode))
(contents
(if (use-region-p) (buffer-substring beg end) (buffer-string)))
(gist (if (use-region-p) (gist-region beg end) (gist-buffer))))
(kill-new
(format "\n[[%s][Gist: %s]]\n#+begin_src %s\n%s\n#+end_src\n"
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
* Inbox of sketches to classify or write about | |
- Learning | |
- [[https://www.flickr.com/photos/sachac/16180954156/][2015.01.04 Rhythm for learning -- index card]] | |
- [[https://www.flickr.com/photos/sachac/16052554957/][2015.01.08 Learning as an event -- index card]] | |
- [[https://www.flickr.com/photos/sachac/16052554877/][2015.01.09 Cross-pollination of ideas -- index card]] | |
- [[https://www.flickr.com/photos/sachac/16077216200/][2015.01.12 How I stopped looking for answers -- index card #reading]] | |
- [[https://www.flickr.com/photos/sachac/16077215930/][2015.01.12 What am I learning about -- index card #plans]] | |
- Emacs | |
- [[https://www.flickr.com/photos/sachac/16206810125/][2015.01.03 Why Emacs -- index card]] |
Base | Expansion |
---|---|
bc | because |
wo | without |
wi | with |
ex | For example, |
[email protected] | |
dote | http://sachachua.com/dotemacs |
web | http://sachachua.com/ |
(defun sacha/open-urls-in-region (beg end) “Open URLs between BEG and END.” (interactive “r”) (save-excursion (save-restriction (narrow-to-region beg end) (goto-char (point-min)) (while (re-search-forward org-plain-link-re nil t) (org-open-at-point)))))
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
**Getting started with Emacs? Empty your cup.** | |
Struggling with learning Emacs because you're just not as productive as you are with your old editor? Copying configuration snippets from the Web in order to force it to work like what you're used to, but running into problems with conflicting code or obscure error messages? | |
Here's something I've realized. To learn Emacs well, you need to empty your cup. This is the story as told on the [C2 wiki](http://c2.com/cgi/wiki?EmptyYourCup): | |
<blockquote>A master was trying to explain something to a student. Now this student was not a brand new student, but a senior student who had learned many things. He had knowledge and experience aplenty to draw upon. But each time the master tried to explain something new to the student, the student kept trying to hold it up against his own notions of the way the world is and how it ought be, and he was unable to see the lessons in what the master was trying to teach him. | |
Finally, the master poured a full serving of tea into his |
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
/** | |
* Upload the file to my Flickr sketchbook and then moves it to | |
* Dropbox/Inbox/To blog. Save the Org Mode links in the clipboard. - | |
* means the photo already existed, + means it was uploaded. | |
*/ | |
var async = require('async'); | |
var cp = require('child_process'); | |
var fs = require('fs'); | |
var glob = require('glob'); |
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
(defun sacha/copy-code-as-org-block-and-gist (beg end) | |
(interactive "r") | |
(let ((filename (file-name-base)) | |
(mode (symbol-name major-mode)) | |
(contents | |
(if (use-region-p) (buffer-substring beg end) (buffer-string))) | |
(gist (if (use-region-p) (gist-region beg end) (gist-buffer)))) | |
(kill-new | |
(format "\n[[%s][Gist: %s]]\n#+begin_src %s\n%s\n#+end_src\n" | |
(oref (oref gist :data) :html-url) filename |
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
# key: sbook | |
# name: Sketched Book | |
# -- | |
**** TOSKETCH ${1:short title} | |
:PROPERTIES: | |
:TITLE: ${2:long title} | |
:SHORT_TITLE: $1 | |
:AUTHOR: ${3:authors} | |
:YEAR: ${4:year} |
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
var fs = require('fs'); | |
var cheerio = require('cheerio'); | |
/** | |
* Process specially-formatted blog post archive and extract image and post URL | |
*/ | |
function extractInfo(article) { | |
var prettyLink = article.find("h2 a").attr("href"); | |
var matches = article.find(".permalink a").attr("href").match(/p\/([0-9]+)/); | |
var postID = matches[1]; |
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
var secret = require('./secret'); | |
var flickrOptions = secret.flickrOptions; | |
var Flickr = require("flickrapi"); | |
var fs = require('fs'); | |
/** | |
* Matches the image filenames in images.txt with the Flickr titles | |
* for images that don't yet have "Blogged" in their description. | |
*/ | |