Elliot Swan

Welcome to my live redesign. Codename, Tumbl3. Grab the feed.

Friday (03/24/06)

Allow me to introduce you to my new little app, Postable 8:31 pm

I absolutely hate having to switch all the “< " and ">” signs in my code to “&lt;” and “&gt;”, respectively. I also hate having to write “&amp;” anytime I want to include an ampersand. This makes including code snippets on my blog and whatnot extremely annoying, and today I finally got fed up.

So, I threw together Postable, a little app that will do all that for you. Just paste your code in there, hit the button…and walla. Post-friendly code.

So try it out, let me know what you think, bookmark it, send it to all your friends, send me money… You get the picture. (Just kidding about that last one, by the way…Well, sort of.) swan

  • Zeerus March 25th, 2006 @ 7:55 pm (#)

    Thank god somebody finally made this, I had even considered making my own for a while, as this is a problem that thoroughly annows me, but you beat me to it. anyway, thanks for a fine tool. btw, nice web 2.0 layout ;-P

  • Elliot Swan March 25th, 2006 @ 10:14 pm (#)

    I couldn’t believe that nobody had done it before, or at least that I hadn’t seen it. I did some googling, but couldn’t find anything.

    And yeah, I’ll admit, I did sort of do the whole “web 2.0 design,” though I wasn’t really going to say that…

  • Oliver Zheng March 25th, 2006 @ 10:40 pm (#)

    Very handy! Instant bookmark.

    I used to open up a WYSIWYG editor, pasting the code, then copying the HTML, which includes the HTML entities already. But this definitely beats that. Very nice job.

  • Oliver Zheng March 25th, 2006 @ 10:45 pm (#)

    Bug #1 :)

  • Elliot Swan March 25th, 2006 @ 10:48 pm (#)

    Well what kind of app would it be if it didn’t have it’s share of bugs? ;)

    I’ll have to look into this…

  • Elliot Swan March 25th, 2006 @ 10:54 pm (#)

    OK, an update on that…

    It will only accept a little over 5000 characters at once, but seriously, who the heck blogs over 5000 characters of code? If you’ve got that much, give them a zip file or something…

  • Nathan Logan March 27th, 2006 @ 6:52 am (#)

    Um, why isn’t this AJAX-powered?

    ;)

    Good stuff - thanks!

  • Nathan Logan March 27th, 2006 @ 7:25 am (#)

    By the by, does this script just run the form submission through PHP’s htmlentities() function and return it, or are you also parsing out something else it doesn’t handle well?

  • Elliot Swan March 27th, 2006 @ 10:50 am (#)

    Nathan,

    It runs it through htmlentities() then runs it through a str_replace() to again change ampersands to &amp;, that way all the entities will show in the textbox rather than just execute.

  • EngLee March 27th, 2006 @ 6:21 pm (#)

    Good job, man. I’ll bookmark it.

  • Paul March 31st, 2006 @ 7:04 am (#)

    Just got around to using this app. Very Nice! I’ve bookmarked it and expect it to be getting a lot of use in the very near future. Great work!

  • ChristianGeek April 2nd, 2006 @ 4:17 pm (#)

    If you ajax the form to server via POST instead of GET, I believe you will not encounter this error.

    My 2 ¢ :D

  • Blog Posible April 5th, 2006 @ 4:25 am (#)

    Aplicación para “formatear” el código para incluirlo en una página web…

    Elliot Swan ha aprovechado bien su tiempo, y nos lo puede ahorrar a los demás, con una sencilla pero muy útil herramienta: postable.
    ¿Y cuál es el objetivo de esta herramienta? Facilitarnos la tarea de insertar código XHTML de ejemplo en una pág……

  • lslinnet April 18th, 2006 @ 4:11 am (#)

    It can’t handle
    php info();
    or at least not when i type it in :)

  • Elliot Swan April 18th, 2006 @ 9:08 am (#)

    That’s because there’s nothing in “php info();” that needs to be converted. :) Now if you did “<?php info(); ?>” it would do some converting.

  • lslinnet April 18th, 2006 @ 2:54 pm (#)

    well i know that i was just testing out your app, trying the
    when typing the php info(); in 1 word the postable makes an error and so does this blog so i guess it’s something to do with your host or something.

  • Elliot Swan April 18th, 2006 @ 3:18 pm (#)

    What’s the error that you get?

    When I type in “<?php info(); ?>” I get “&lt;?php info(); ?&gt;”–Which is exactly what should happen.

  • lslinnet April 18th, 2006 @ 3:36 pm (#)

    well write:
    the command “php info();” this should be in 1 word like phpinfo
    wrap some php tags around it if you want to.
    look it up on php.net can’t seem to post the right commant get some weird error, think it’s because of your host at it is also preventing me from writing it on this site too.

  • Elliot Swan April 18th, 2006 @ 3:41 pm (#)

    Ah, I see what you mean now. Yeah, it’s probably a dreamhost thing, trying to keep the server secure I’m guessing.

  • Montoya July 28th, 2006 @ 4:24 am (#)

    You know what would be cool? To find a javascript equivalent of htmlentities() and roll this little app into a Konfabulator/OSX compatible widget. I would love to give it a shot, let me know if you are interested.

  • JY December 15th, 2006 @ 8:29 am (#)

    I think this can be achieved using javascript alone. I’m building a javascript version of Postable. I’ll add another comment when done.

  • Elliot Swan December 15th, 2006 @ 2:13 pm (#)

    It could probably be done with a series of reg expressions, but you’ll have to go through and find all the HTML entities for everything you’re going to want to transform–I just used htmlentities() then a quick str_replace() to fix ampersands. When you do it that way, all the html entities will be replaced without tons and tons of code.

    Is there really any reason to have a pure JavaScript version?

  • Montoya December 15th, 2006 @ 3:28 pm (#)

    There’s no good reason to have a pure Javascript version on the web, but it could be good for making a desktop widget. I was actually thinking of making something similar for just that reason, but never got around to it.

  • Elliot Swan December 15th, 2006 @ 10:39 pm (#)

    Yeah, that’s true. From his comment, it sounded like it was for online use…maybe I read it wrong.

  • JY December 20th, 2006 @ 1:46 pm (#)

    I made one. I haven’t tested Safari.

    HTML Escaper and Javascript String Escaper

    I have no exprience with desktop widget programming. But if somebody want to make a widget, she or he can copy and modify existing code if its license allows.

  • Nate January 22nd, 2007 @ 12:13 pm (#)

    I wanted to write a javascript function that could take as input an element’s id and spit out a code block below the element automatically, so it would make my documentation easier, anyone seen something like it I can use?

    IE innerHTML looks like hell (ruins my beautiful XHTML!)
    Firefox innerHTML looks great, but I want a cross-browser solution ;)

  • Alan January 31st, 2007 @ 9:34 pm (#)

    Elliot,

    I have used this many times before. just recently I have found it again, and writing some code I’m doing it’s been invaluable.

    Many thanks.

    -Alan

  • Aaron Bassett August 3rd, 2007 @ 5:04 am (#)

    but you’ll have to go through and find all the HTML entities for everything you’re going to want to transform

    php.net: get_html_translation_table
    get_html_translation_table() will return the translation table that is used internally for htmlspecialchars() and htmlentities().

  • magpie August 4th, 2007 @ 4:14 pm (#)

    rockin’ stuff!

    thnx

  • Antyczek September 6th, 2007 @ 6:44 am (#)

    Great !! Thanks!

  • Dale Hay November 1st, 2007 @ 12:51 pm (#)

    Nice idea mate, I have my own version of this up and running too. ( HTML Friendly )


    Dale Hay

  • デリヘル November 6th, 2007 @ 2:14 am (#)

    Write a comment here.

  • デリヘル November 6th, 2007 @ 2:15 am (#)

    Write a comment here. Thank you

  • Post codes to blog posts/comments with Postable November 16th, 2007 @ 4:04 am (#)

    […] The developer of the tool, Elliot Swan, has spelt out everything in his announcement post. The name, “Postable”, is written in large letters (sans reflection). There is a code box, and a simple button named “make it friendly” below. It is AJAXed, which saves you a reload of the page. I tested it on a slow connection, and it managed to load quite fast. The scripts working behind the screen are Prototype and Scriptaculous JS library, along with a custom script. […]

  • Tool Tuesday: Postable » Techtites November 26th, 2007 @ 11:38 pm (#)

    […] The purpose behind Postable is to help you when you are posting code either on your blog or in a comments field. […]

  • […] Have you ever wanted to put code into a post without it being interpreted as code? A while ago I was trying to write a page to include code for buttons for my blog. After much struggling with the WYSIWYG editor I eventually managed to write it. If only I had seen this post from Elliot Swan ‘Allow me to introduce you to my new little app Postable’ then it would have been much easier! […]

  • Jeremy Martin March 24th, 2008 @ 8:39 am (#)

    Hey, it’s this post’s two year anniversary! Anyway, I’m not sure if you’re still updating Postable or not, but I’ve noticed it seems to strip out the ‘+’ symbol. Other than that, I love it and use it often!

  • john March 28th, 2008 @ 7:27 pm (#)

    Great little app - saves so much time and there is no need for installing any of the various plug ins available. I do tutorials from time to time on My Site and this is going to help me do things a lot lot quicker! Thanks!
    John

  • Jeremy Martin April 2nd, 2008 @ 6:52 am (#)

    Hey all - I just went live with yet another one. The major differences are that mine is implemented completely with regex on the client side (and therefore super fast) and it also provides several different options to customize the output. I’ve been using Postable for awhile, and it’s great - but I ultimately needed a little more flexibility. Let me know what you think!
    Asciible

  • Daniele April 25th, 2008 @ 2:10 am (#)

    Elliot, very good tool! Thanks :)

Say Something.





I'm a nice guy, so I'll let you use basic XHTML such as <a>, <strong>, <em>, <blockquote>, and <code>. If you're trying to share some code with us, just make sure to run it through Postable first.

Write your comment