Skip to content

Instantly share code, notes, and snippets.

View sachac's full-sized avatar

Sacha Chua sachac

View GitHub Profile
@sachac
sachac / gist:9aae1e34bb6f4d6d1299
Last active August 29, 2015 14:01
Gnus BBDB Salutations
;; This version is for BBDBv3 - thanks, Thomas!
(defvar wicked/gnus-nick-threshold 5 "*Number of people to stop greeting individually. Nil means always greet individually.") ;; (1)
(defvar wicked/bbdb-hello-string "Hello, %s!" "Format string for hello. Example: \"Hello, %s!\"")
(defvar wicked/bbdb-hello-all-string "Hello, all!" "String for hello when there are many people. Example: \"Hello, all!\"")
(defvar wicked/bbdb-nick-field 'nick "Symbol name for nickname field in BBDB.")
(defvar wicked/bbdb-salutation-field 'hello "Symbol name for salutation field in BBDB.")
(defun wicked/gnus-add-nick-to-message ()
"Inserts \"Hello, NICK!\" in messages based on the recipient's nick field."
@sachac
sachac / gist:60989ef6f0a76da126fc
Created December 4, 2014 14:45
Source for my monthly review for November 2014

Monthly review: November 2014

I wrote last month that in November, I planned to:

  • Get team members up to speed with prototype designs and reporting tips
  • What are outlines good for?
    • Capturing thoughts quickly
    • Writing non-linearly
    • Roughly organizing your thoughts
    • Deciding depth and coverage
    • Rearranging them for a more logical flow
    • Writing quickly
    • Picking things up where you left off
    • Seeing the gaps
    • Simplifying
@sachac
sachac / Sacha.el
Last active August 29, 2015 14:12
Sorting sexps alphabetically. May be handy for finding accidental duplicates.
(defun sacha/sort-sexps-in-region (beg end)
"Can be handy for sorting out duplicates.
Sorts the sexps from BEG to END. Leaves the point at where it
couldn't figure things out (ex: syntax errors)."
(interactive "r")
(let ((input (buffer-substring beg end))
list last-point form result)
(save-restriction
(save-excursion
(narrow-to-region beg end)
(defun sacha/org-count-tasks-by-status ()
(interactive)
(let ((counts (make-hash-table :test 'equal))
(today (format-time-string "%Y-%m-%d" (current-time)))
values)
(org-map-entries
(lambda ()
(let* ((status (elt (org-heading-components) 2)))
(when status
(puthash status (1+ (or (gethash status counts) 0)) counts))))
var secret = require("./secret");
var flickrOptions = secret.flickrOptions;
var Flickr = require("flickrapi");
exports.trimTitle = function(str) {
return str.replace(/ --.*$/g, '').replace(/#[^ ]+/g, '').replace(/[- _]/g, '');
};
var hash = {};
var fs = require('fs');
var cheerio = require('cheerio');
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];
var title = article.find("h2").text();
var date = article.find(".date").attr("data-date");
return { prettyLink: prettyLink,
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.
*/
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];
# key: sbook
# name: Sketched Book
# --
**** TOSKETCH ${1:short title}
:PROPERTIES:
:TITLE: ${2:long title}
:SHORT_TITLE: $1
:AUTHOR: ${3:authors}
:YEAR: ${4:year}