Showing posts with label tips. Show all posts
Showing posts with label tips. Show all posts

Friday, December 9, 2011

Efficient Javascript Tips

Opera Developer Blog recently put up a post on Efficient Javascript Tips. It's worth reading if you  develop with Javascript.

ECMAScript
  1. Avoid using eval or the Function constructor
    1. Rewrite that eval
    2. If you want a function, use a function
  2. Avoid using with
  3. Don't use try-catch-finally inside performance-critical functions
  4. Isolate uses of eval and with
  5. Avoid using global variables
  6. Beware of implicit object conversion
  7. Avoid for-in in performance-critical functions
  8. Use strings accumulator-style
  9. Primitive operations can be faster than function calls
  10. Pass functions, not strings, to setTimeout() and setInterval()

DOM

  1. Repaint and reflow
    1. Keeping the number of reflows to a minimum
    2. Minimal reflow
  2. Document tree modification
  3. Modifying an invisible element
  4. Taking measurements
  5. Making several style changes at once
  6. Trading smoothness for speed
  7. Avoid inspecting large numbers of nodes
  8. Improve speed with XPath
  9. Avoid modifications while traversing the DOM
  10. Cache DOM values in script variables

Document loading

  1. Avoid keeping alive references from one document to another
  2. Fast history navigation
  3. Use XMLHttpRequest
  4. Create SCRIPT elements dynamically
  5. location.replace() keeps the history under control

Wednesday, December 7, 2011

How to Google

SmashingApps released this infographic recently on getting more from Google

Monday, December 5, 2011

Github Secrets

Here are some Github features you may not know about:

  1. Whitespace: Ever have someone push a commit that involves a lot of real changes mixed in with a bunch of less-meaningful whitespace? Add ?w=1 to the URL to see the diff with whitespace ignored.
  2. Cross-Repository Issue References: Sure, GitHub's all about social coding, but you can have social repositories, too. You can reference issues between repositories by mentioning user/repository#number in an issue. Once we see something like that — say, github/enterprise#59 — we'll make sure to update issue #59 in github's enterprise repository and let you know where it was referenced from. This is a part of GitHub Flavored Markdown, which also has a few tricks of its own.
  3. Hot Branch on Branch Pull Request Action: Pull Requests are awesome. They make it really easy to merge code between forks. But did you know you can use Pull Requests between branches, on the same repository? You don't need to fork repositories to use Pull Requests. Internally at GitHub, we almost always use Pull Requests between branches.
  4. Filter Notifications by Repository or User: Email notifications for Issues, Pull Requests, and Gists can easily be filtered by the List-ID header. Look for this header value to sort your notifications, or even forward them to a more appropriate email account. You can filter on *.org.github.com to filter out emails by organization, or repo.org.github.com to filter out emails from a specific repo.
  5. Subscribe to Threads: Now that you've got your mail filtering notifications, did you know you can let us know which threads to keep you notified on? On the bottom of the page, you can scroll down and click Enable notifications and we'll send you a notification when it's been updated. This works for issues, commit notes, pull requests... you name it. Too much email? You can disable it just as easily.
You can read the whole post on their blog.