Skip to content

Instantly share code, notes, and snippets.

View sachac's full-sized avatar

Sacha Chua sachac

View GitHub Profile
@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",
@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 / 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: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 / 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.
(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 / emacsconf2013-sacha.org
Created March 31, 2013 00:04
Source code for my Emacs conference talk

Comments? [email protected]

  • 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