Pin Me

Shortcut your Code with Texter

written by: sherisaid•edited by: Michele McDonough•updated: 7/31/2009

Being a web developer has many rewards, but debugging and data entry are not among them. Using Texter can cut your commonly used code keystrokes - quite literally - in half.

  • slide 1 of 2

    What is Texter?

    Being a web developer usually comes with pretty good keyboard skills, but who wants to reduce exciting code to tedious data entry if there's a shortcut? Most snippet IDE's are a little clunky to use, so LifeHacker's Texter tool is a nice alternative. It was intended to be an Autohotkey chat tool, so you can text in your favorite webspeak and it's automatically translated to full text (example: ttyl – talk to you later). But programmers can use this to their advantage by building a library of code they frequently use.

    Texter is easy to set up and use. Basically, you define a list of functions related to certain keywords. To access the function, you type the keyword and hit the trigger key, and Texter replaces your text with the library code.

    To put this to use as a code engine, imagine writing a PHP function that displays an endless string of variables pulled from a large database. Typing it out by hand makes mistakes all too common. By loading Texter Hotstrings in front and back, you can reduce typing to just a few characters.

  • slide 2 of 2

    An Example

    This statement trims any spaces from the right side of a username when someone attempts to log in – a common problem that disallows login and should be part of any member login code: $tmp_username=rtrim(substr($tmp,117,40));

    Since this is a command a web developer would use on many websites, the only pieces that must be changed are the field location and character count. Variable names can remain the same within unique documents. To use Texter to create a string function for this command, choose a keyword, like [user] and define a function to replace [user] with $tmp_username=rtrim(substr($tmp, then type in the correct numbers and use a second keyword, like [/var] to end the string with )); As a result, you reduce your keystrokes from 41 to 20, including tapping the trigger, by typing only [user]117,40[/var]. And unlike PHP code, if you make a typo, you'll know it immediately, because the replacement code will not execute. You won't have to painstakingly search every character of the document to find it, or worse, crash your entire codeset over a missing semi-colon.

    Using Texter to short cut your code is a great way to save both time and money by saving keystrokes and cutting debugging in half. Since most web developers use the same code on a regular basis, it makes sense to find a way to insert that, without relying on pre-programmed libraries that may not have what you need. You can also use it to store symbols, like ©, create a whole block of header code, fix words you know you always misspell, and anticipate your own mistakes.