Tagged: php RSS Toggle Comment Threads | Keyboard Shortcuts

  • rajbot 12:20 pm on August 15, 2007 Permalink | Log in to leave a Comment
    Tags: , php   

    Linking WordPress to DokuWiki 

    I wrote a WordPress plugin that turns any CamelCase word into a link to our DokuWiki, assuming a wiki page of the same name exists.

    For example, you can link to RanchTronix or KiteSurfing or whatever, just by typing a word in CamelCase. The wiki is really out of date, so please update it!

    DokuWiki is not case-sensitive, so you can use RaNChTroNiX style capitalization :)

    You can also use double-square brackets to surround a non-camelcase word to turn it into automagic wiki link like so: [[AVR]]

    If you want to use it on your own site, the source is here.

  • rajbot 10:55 pm on March 20, 2007 Permalink | Log in to leave a Comment
    Tags: , , php   

    How to keep WordPress from borking your post 

    Sometimes you just want to post a code snippet or some xml on your blog, but WordPress borks the formatting. So we installed the iG Syntax Hilighter, which mostly works great. It uses GeSHi under the hood.

    But sometimes, the syntax highlighter does too much highlighting. I wrote a minimal GeSHi language file for ‘nocode’, which basically lets me use the syntax highlighter like a glorified pre tag. No more worrying about wptexturize() pulling a Swedish Chef on your post! Here is the language file if you want to use it:

     * nocode.php
     * -------
     * Author: rajbot
     * I wanted a <pre> that didn't fuck everything up..
    $language_data = array (
    	'LANG_NAME' => 'NOCODE',
    	'COMMENT_SINGLE' => array(),
    	'QUOTEMARKS' => array(),
    	'KEYWORDS' => array(),
    	'OBJECT_SPLITTERS' => array(
    	'REGEXPS' => array(),
    	'SCRIPT_DELIMITERS' => array(
  • rajbot 12:44 am on March 20, 2007 Permalink | Log in to leave a Comment
    Tags: , php   

    Announcing the TikiWikiFormatting WordPress plugin! 

    I wrote a plugin that lets us use UseMod Wiki’s formatting syntax to format posts more easily… You can read more about it here. It’s already installed here, so go nuts!

    I’m sure the first thing that jumped into your head is why not just use MarkDown? Well, I don’t like MarkDown’s link format. UseMod’s is much easier!

    Compare Markdown:

    [The TikiRobot Blog!](http://tikirobot.net/)

    And UseMod links:

    [http://tikirobot.net The TikiRobot Blog!]


    • I like the way
      • UseMod syntax
        • lets me easily create sublists

    Are there any other UseMod syntax elements I should add?

  • rajbot 2:35 am on March 18, 2007 Permalink | Log in to leave a Comment
    Tags: , , , php, ,   

    Example Scripts: REST web services and system calls 

    I’ve been translating all the new perl and php scripts I write into Python and Ruby in order to learn more about those two languages. I checked some more example scripts into SourceForge, which might be useful for others who know one of these languages and want to learn a new one.

    These scripts are available in perl, php, python, and ruby:

    The REST Web Service PHP and Perl scripts don’t work in Mac OS X, because OS X doesn’t ship with Perl’s XML::Simple or PHP’s simplexml. More surprisingly, OS X doesn’t ship with Perl’s LWP module.

    I’m starting to like Ruby more every day. It would be nice if Ruby and Python had a XML::Simple equivalent in their standard distributions.

  • rajbot 1:36 am on March 15, 2007 Permalink | Log in to leave a Comment
    Tags: , , , php, ,   

    Example scripts: directory listing in perl, php, python, and ruby 

    I remember when I fell in love with Perl. It was the summer of 1995, and peliom and I had just met, and were working at the Lab. Postscript hacking using MacPerl on OS 8. It was beautiful.

    That was more than ten years ago, and even though I’ve remained a Perl hacker the whole time, I see massive amounts of development happening on Python and Ruby, and the Perl community seems to be slowing down (what’s up with Perl 6 anyway?), so, despite the lack of block-level scope, I think it might finally be time to move on.

    I don’t know enough about either Python or Ruby to figure out which to learn, so I’ll learn them both, and deal with choosing one later. Along the way I’ll post some example scripts. Anyone else making the jump from Perl or PHP to something modern might find these useful. Here is the first example: printing out a directory listing using readdir and glob in your favorite scripting language:

    (More …)

    • Pete 6:10 am on March 15, 2007 Permalink | Log in to Reply

      Neat, I’ve been thinking of looking in to ruby recently, but haven’t had the time.

      Oh, and with perl, there’s always more than one way to do it :)

      Neat thing about fileglobbing in perl is that you don’t need to use glob(), you can just use the diamond operator:

      foreach(@_=){print “$_\n”;}

      works great!

    • Pete 6:11 am on March 15, 2007 Permalink | Log in to Reply

      Oops, there should be a (greaterthan)/*(lessthan) after @_=

    • rajbot 9:10 am on March 15, 2007 Permalink | Log in to Reply

      Thanks Pete!

      I’m intentionaly trying to avoid using Perl idioms that only Perl people can understand. After talking to a few non-perl people, it seems like they mostly hate perl because they can’t grok the syntax of the idioms, and those are easy to avoid. Well, also, objects.

      I totally understand the desire to type as few chars as possible, but I’ve found that non-perl people are generally ok with perl code that doesn’t use idioms and special variables.

      You can enclose code blocks in


      followed by /code in square brackets

  • rajbot 6:42 pm on October 1, 2006 Permalink | Log in to leave a Comment
    Tags: , php   

    Adding a confirmation for WordPress posts tagged with the default category. 

    The standard install of WordPress automatically adds new posts to the ‘Uncategorized’ category, and it’s up to you remove the tag. Peliom sez:

    by default posts are tagged as “Uncategorized,” and no warning when I forget to tag. This is more annoying than it sounds.

    I added a confirmation to our WordPress install that warns you when you are about to save or publish a post with the default category selected. If you want to do this too, make these two small edits to edit-form-advanced.php:
    <form name="post" action="post.php" method="post" id="post"> becomes:
    <form name="post" action="post.php" method="post" id="post" onsubmit="return confirmCategorySelected()">
    and add this function to the file:

    <script type="text/javascript">
    function confirmCategorySelected() {
    	if (document.getElementById('category-1').checked) {
    		return confirm('The default category (Uncategorized) is still checked. Do you really want to continue with this post?');
    	} else {
    		return true;
compose new post
next post/next comment
previous post/previous comment
show/hide comments
go to top
go to login
show/hide help
shift + esc