Skip to content

Instantly share code, notes, and snippets.

View sachac's full-sized avatar

Sacha Chua sachac

View GitHub Profile
@sachac
sachac / emacsconf2013-sacha.org
Created March 31, 2013 00:04
Source code for my Emacs conference talk

Comments? sacha@sachachua.com

  • Emacs learning curve?

Meta information

Assumptions

  • Mix of Emacs geeks skewed towards people who’ve been using this for a while (after all, takes a certain commitment to come all the way to an Emacs conference!)

Outcomes

(defun teletype-char (c short-pause long-pause)
(let ((med-pause (/ (+ long-pause (* 2 short-pause)) 3.0)))
(cond
((equal c ?.)
(insert (char-to-string c))
(sit-for long-pause))
((equal c ?,)
(insert (char-to-string c))
(sit-for med-pause))
((equal c ?\n)
@sachac
sachac / gist:5918573
Created July 3, 2013 14:41
LivingAnAwesomeLife.com chat: July 3, 2013
07/03/2013 09:56:55 Sacha Chua: You made it!
07/03/2013 09:57:07 Sacha Chua: I think you may need to click on the mic icon near the top to enable it, if it isn't enabled yet
07/03/2013 09:57:53 Charo Nuguid: Yeah, I'm having trouble with my mic and anymeeting at the moment. Still figuring out what's wrong.
07/03/2013 09:58:10 Sacha Chua: If you hover over the mic, you can get to the Audio options screen.
07/03/2013 09:58:22 Charo Nuguid: yup.
07/03/2013 09:58:27 Sacha Chua: Awesome! =)
07/03/2013 09:58:37 Charo Nuguid: Just that anymeeting isn't playing nice with Ubuntu. :D
07/03/2013 09:58:41 Sacha Chua: Oh noes!
07/03/2013 09:59:01 Sacha Chua: I'll keep playing around. Do you have a favourite web conferencing thing?
07/03/2013 09:59:01 Charo Nuguid: Let me try going out and back in again. Must be something with adobe permissions.
@sachac
sachac / gist:6053864
Created July 22, 2013 13:36
Outline of learning skills?
- Skills for learning
- Identify something to learn
- Identify a possible gap, opportunity, or goal
- Identify the next steps towards a goal
- Identify the next steps from what you know
- Ask for or receive advice from other people
- Identify learning concepts based on other resources
- Recognize learning opportunities
- Recognize multiple opportunities to learn from the same
experience
@sachac
sachac / concat_html.rb
Created August 1, 2013 14:13
Concatenate Wordpress blog pages for later text manipulation
#!/usr/bin/env ruby
# Retrieves and concatenates Wordpress blog pages, being sure to
# include only the BODY/specified elements from other files
#
# Usage: concat-html.rb URL [css selector for element] [max page number]
require 'rubygems'
require 'nokogiri'
require 'open-uri'
@sachac
sachac / gist:6134428
Last active December 20, 2015 12:49
Patch for shareadraft to add a box to the post edit page
diff --git a/shareadraft.php b/shareadraft.php
index 4db1751..8fd329e 100644
--- a/shareadraft.php
+++ b/shareadraft.php
@@ -23,7 +23,8 @@ class ShareADraft {
add_action('admin_menu', array($this, 'add_admin_pages'));
add_filter('the_posts', array($this, 'the_posts_intercept'));
add_filter('posts_results', array($this, 'posts_results_intercept'));
-
+ add_action('add_meta_boxes', array($this, 'add_meta_boxes'));
@sachac
sachac / term-management-tools.merge-tags-when-converting.diff
Created August 27, 2013 17:46
Term management tools - silently merge tags when converting
diff -u ./term-management-tools/term-management-tools.orig.php ./term-management-tools/term-management-tools.php
--- ./term-management-tools/term-management-tools.orig.php 2013-08-27 13:06:32.000000000 -0400
+++ ./term-management-tools/term-management-tools.php 2013-08-27 13:43:24.000000000 -0400
@@ -175,6 +175,17 @@
);
}
+ $term2 = get_term_by('name', $term->name, $new_tax);
+ if ($term2) {
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->term_relationships SET term_taxonomy_id=%d WHERE term_taxonomy_id=%d",
;; Totally untested
(defvar clarissa/beeminder-user "example" "Username for Beeminder service.")
(defvar clarissa/beeminder-token "1234" "Token - get this from https://www.beeminder.com/api/v1/auth_token.json")
(defun clarissa/beeminder-post (goal datapoint)
(interactive "MGoal: \nMData: \nMToken value: ")
(let ((url-request-data (json-encode `((value . ,datapoint) (auth_token . ,clarissa/beeminder-token))))
(url-request-method "POST")
(url-request-extra-headers '(("Content Type" . "application/json")))
(url-mime-encoding-string "identity"))
@sachac
sachac / gist:11090358
Last active August 29, 2015 14:00
Little snippet to run command in term instead of inserting in region
(defadvice org-babel-execute:sh (around sacha activate)
  (if (assoc-default :term (ad-get-arg 1) nil)
    (let ((buffer (make-term "babel" (or explicit-shell-file-name
                                         (getenv "ESHELL")
                                         (getenv "SHELL")
                                         "/bin/sh"))))
      (with-current-buffer buffer
        (insert (org-babel-expand-body:generic
             body params (org-babel-variable-assignments:sh params)))
@sachac
sachac / gist:0eb152c9ffe74cd2fe23
Last active August 29, 2015 14:01
Notes for ILC talk?

Title: Taking over the world, two parentheses at a time

How can we get more people to use and love Lisp? Come to this session for practical tips on applied selfishness and community-building, and join in the conspiracy to take over the world (or a reasonable portion thereof). I’ll share some stories from Emacs evangelism, including new tools, beginner-friendly approaches, and the effectiveness of indirect brainwashing.

Bio: Sacha Chua loves getting Emacs to do all sorts of things that boggle casual passers-by. She’s working on more resources for Emacs beginners and enthusiasts, including doodled cheat sheets and interviews with people who are even more into Emacs Lisp than she is (emacslife.com). You can check out her blog at LivingAnAwesomeLife.com or follow her on Twitter (@sachac).