I need a break …

I don’t usually talk much about my day-to-day life here, but that doesn’t mean I never do. This is one of those times. If you just want more tech talk check out the end of this post. The rest is all me whinging anyway. ;)

I need a break. A real break. I mean, I am technically on a break right now from school but it doesn’t really feel that way. I finished out my first year of school a couple weeks ago (26 years after graduating from high school, no less) and I thought “wow, I have an entire month that I can use to rest, catch up on some personal stuff, maybe clean out the garage ….” Unfortunately it is not turning out that way.

Instead I am writing this at 5:54 in the morning as this has been the first chance I have had to pay any attention at all to the blog. So what has been keeping me busy? Well, first, there is work. I did use a little of what would have been study time to modify the script I use to generate weekly work reports from Trac so that it now shows the amount of change for hours on each ticket (which is set in a “custom” field). And holy cow, I put in 58.5 hours last week. At least 8 of that doesn’t really count, though. I messed my back up and spent some time trying to work while under the influence of cyclobenzaprine which means that I wrote, scrapped and rewrote one class method at least 6 times before finally giving up. (Programming and drugs that make you stupid don’t mix!)

Aside from work I have been putting some time into a project for a non-profit that is kicking off on May 12th. I’m not allowed to say too much about it ahead of launch, but I can say that it is about raising awareness about ME/CFS and how badly it has been mismanaged and patients marginalized for the past 25 years.

Finally, I upgraded the WordPress plugin Shorten2Ping which I will continue to pimp as long as it keeps working so well. Of course I like my post tweets to have some hashtag love, so I do a little editing of the shorten2ping.php.

Here is a diff:

--- shorten2ping/shorten2ping.php       2010-04-12 10:22:34.000000000 -0700
+++ shorten2ping.mine/shorten2ping.php  2010-04-19 06:47:58.000000000 -0700
@@ -119,6 +119,15 @@
     $post_url = get_permalink($post_id);
     $post_title = strip_tags($post->post_title);

+               // add some tag bits here
+               $tags = wp_get_post_tags($post_id);
+               $my_tag_list = '';
+               if (is_array($tags)) {
+                       foreach ($tags as $j=>$tag) {
+                               $my_tag_list .= '#'.$tag->slug.' ';
+                       }
+               }
     $short_url_exists = get_post_meta($post_id, 'short_url', true);

              if (empty($short_url_exists)) {
@@ -205,9 +214,19 @@

             //get message from settings and process title and link
             $message = $s2p_options['message'];
+                                               $message_bare_char_count = strlen(str_replace(array('[title]','[link]','[tags]'), '', $message));
+                                               $title_count = strlen($post_title);
+                                               $link_count = strlen($short_url);
+                                               $tag_count = strlen($my_tag_list);
+                                               $over = $message_bare_count + $title_count + $link_count + $tag_count - 140;
+                                               if ($over > 0 && $over <= $post_title/2) {
+                                                       // if the overage is more than half the post title then skip it and let tags get truncated
+                                                       $post_title = substr($post_title, 0, $title_count - $over);
+                                               }
             $message = str_replace('[title]', $post_title, $message);
                              $message = str_replace('[link]', $short_url, $message);
+                                               $message = str_replace('[tags]', $my_tag_list, $message);
             if ($s2p_options['ping_service'] == 'pingfm'){


(You can download the diff as well.)

Ooops! Draft Saved at 6:23:27 am. And it is now 8:10, and this would still be a draft if I wasn’t closing browser tabs.

3 Responses so far

  1. 1

    Tweets that mention evardsson.com: stuff that w0rks » Blog Archive » I need a break … -- Topsy.com said,

    April 28, 2010 @ 5:44 am

    […] This post was mentioned on Twitter by Sjan Evardsson. Sjan Evardsson said: New Post: I need a break … – http://bit.ly/cU4SlZ #wordpress […]

  2. 2

    Richard said,

    October 30, 2010 @ 6:02 pm

    Would you be available to do a custom project involving Shorten2ping?
    Please respond in you are.

    Thanks for your time!

  3. 3

    Sjan Evardsson said,

    November 2, 2010 @ 6:29 am

    I could be available to provide some help, although time is still at a premium. It may be only a few hours a week, but I would be willing to help out the coolest WP plugin ever!

Comment RSS