Difference between revisions of "Developer Tips"

From Dreamwidth Notes
Jump to: navigation, search
(move dev history link to main dev page; +Zen Coding/Emmet pointer)
Line 28: Line 28:
  
 
Otherwise, go wild. :)
 
Otherwise, go wild. :)
 +
 +
== Saving Keystrokes ==
 +
 +
Most editors have ways of autocompleting the things you commonly need to type, either built-in or via plugins.  One of the more well-known plugins is [https://github.com/emmetio/emmet Emmet], aka [http://code.google.com/p/zen-coding/ Zen Coding].  It's available for almost any editor, and is designed to let you enter complicated HTML or CSS expressions with a minimal number of keystrokes.  For instance, entering this:
 +
 +
<code>
 +
ul.img-list>li*3>a>img
 +
</code>
 +
 +
...and then hitting the Zen Coding "expand" key combo gives you this: 
 +
 +
<source lang="html4strict">
 +
<ul class="img-list">
 +
    <li>
 +
        <a href=""><img src="" alt="" /></a>
 +
    </li>
 +
    <li>
 +
        <a href=""><img src="" alt="" /></a>
 +
    </li>
 +
    <li>
 +
        <a href=""><img src="" alt="" /></a>
 +
    </li>
 +
</ul>
 +
</source>
 +
 +
  
 
{{MoreInfo}}
 
{{MoreInfo}}
  
[[Development History]] - some commentary on why stuff was done the way it was.
 
 
[[Category: Development]]
 
[[Category: Development]]

Revision as of 03:28, 6 April 2013

Showing Whitespace

Dreamwidth does not want tabs or trailing whitespace, as per the Dev Programming Guidelines. These two tips can help you check out your patch before submission for these flaws.

In vim, you can show whitespace with the command

:set list

You can also use cat -et.

Error Messages

In .bml files, if you get an error message with a line number, the line numbering starts from the beginning of the code block, not from the beginning of the file.

The Daily Snapshot

Even if you don't use a Dreamhack for your development, the Dreamhack service can still help, because one of the Dreamhacks on the service is special - it's a live, always-running daily snapshot of the Dreamwidth code which is automatically reinstalled each day at 12:30am GMT. If you ever need to test something on a clean installation of the code, and don't require SSH access, you can use the Daily Snapshot at:

http://www.daily.hack.dreamwidth.net/

Feel free to make whatever changes you like; the 'hack is automatically reinstalled each day, so none of your changes will last long. (Similarly, if you find that someone else has messed with the installation enough for it to be unuseable for your purpose, you can simply wait a day and it'll be back to normal.)

Some notes about the service:

  • Invite codes are turned off. You can create a new account by clicking "Create Account" in the Create menu.
  • The password for the 'system' account is 'system'. Please don't change this unless you're testing something specifically related to that. (If you are, then be aware that the password, like everything else, will revert back to 'system' on the next reinstall.)
  • If the Daily Snapshot is ever down, check if it's just after 12:30am GMT. If so, it's probably in the middle of reinstalling - try again in a few minutes. Otherwise, there's either a bug in the codebase that's preventing Apache from starting, or something about the installation has changed that [info]sophie hasn't adjusted the Dreamhack installation script for. Let her know. :)

Otherwise, go wild. :)

Saving Keystrokes

Most editors have ways of autocompleting the things you commonly need to type, either built-in or via plugins. One of the more well-known plugins is Emmet, aka Zen Coding. It's available for almost any editor, and is designed to let you enter complicated HTML or CSS expressions with a minimal number of keystrokes. For instance, entering this:

ul.img-list>li*3>a>img

...and then hitting the Zen Coding "expand" key combo gives you this:

<ul class="img-list">
    <li>
        <a href=""><img src="" alt="" /></a>
    </li>
    <li>
        <a href=""><img src="" alt="" /></a>
    </li>
    <li>
        <a href=""><img src="" alt="" /></a>
    </li>
</ul>


This article could really use expansion. If you have information to add, please edit this page!