HTML, CSS, and Javascript Auto Formatter (Tidy / Beautify)

I’ve been using Sublime Text 2 for a few months now and it’s by far the best code editor I’ve ever used. BUT, surprisingly it doesn’t even come with a code auto-formatter. There are some plugins but some don’t work and others required additional dependencies. So, here’s a web-based formatter called Dirty Markup that can clean up your HTML, CSS, Javascript very quickly and easily.

http://dirtymarkup.com/

Minify + Compress Website Assets for Faster Performance

To increase website performance, one best practice is to minify and compress your assets and put them on a CDN.

Minify
To minify assets like CSS and Javascript files, there are many tools available.  YUI Compressor seems to be one of the best for compressing Javascript files.

Compress
To compress assets like CSS and Javascript files, there are manytools available. Gzip seems to be one of the best ones. On Windows, you can use 7-Zip to do the compression as shown below.

CDN
One cheap CDN you can use is Amazon’s CloudFront. It has a web interface as well as an API.  You first upload files to Amazon S3 and then reference your files using the CloudFront URL. Just remember to set your files metadata correctly as shown below for javascript.

For CSS files, you would set the Content-Type value to “text/css” without quotes.

For CSS files, you would set the meta data to

content-encoding: gzip
content-type: application/javascript
cache-control: max-age=31449600

Including files
When referencing files in your web pages, using protocol-less URLs, e.g.

<link charset=”utf-8″ href=”//d1dejaj6dcqv24.cloudfront.net/vendors/jquery-ui.selectmenu/jquery-ui.selectmenu-1.2.0.min.gz.css” rel=”stylesheet” type=”text/css”>

Javascript Tools

Here is  a collection of useful Javascript tools:

  1. Javascript Minifier – Compress your Javascript to make it a smaller file size for faster downloads
    YUI Compressor
    YUI Compressor GUI 1.0 for Windows

    There’s no need to check any of the boxes.
  2.  JS Beautifier – Pretty-print your Javascript
    http://jsbeautifier.org/
  3. JS Lint – Check your Javascript for errors
    http://jslint.com/
  4.  JSON Lint – Check your JSON code for errors
    http://jsonlint.com/

Mobile App Development Options

Lately, I’ve been in a mobile-app-development phase. I have a couple of ideas for some mobile apps and wanted the easiest way to develop them. Here are the current possibilities:

  • 100% Native
    You can build a native mobile app that looks great and performs well but you have to develop in the language required by the platform. iOS uses Objective-C. Android uses Java. And Microsoft and others use other languages.
  • 90% Native
    You can build mobile apps for many platforms (iOS, Android, etc) using just Javascript if you use the Appcelerator Titanium SDK.  The SDK provides a bridge to over 3000 native commands so your apps look like native apps and perform almost just as well. eBay’s mobile app uses Appcelerator Titanium and this is my preferred choice.
  • 10% Native
    You can build a mobile app using HTML, CSS, and Javascript which is basically a small website. This website then gets wrapped using PhoneGap which turns it into an app. PhoneGap also provides hooks into 10 or so device features such as the accelerometer, geolocation, camera, etc. While this is probably the easiest approach, it would be difficult to make your app look like a native app and it would be even more difficult to make it perform like one.

SSH and SFTP Clients for Windows

When I first started using SSH on Windows, I used PuTTY, which seems to be the most popular. However, I noticed it was lacking in so many ways. So, my current Windows SSH client of choice is ZOC. It’s not free, but if you use SSH a lot, then it’s worth it.

I also used to use FileZilla for FTP but now I’ve found WinSCP to be better. It supports synchronized browsing, file transfer presets / masks / filters, local and remote synching of files, and much more. It’s free.

Password-less SSH Authentication with PuTTy and Key Autoloading with Pageant

http://www.ualberta.ca/CNS/RESEARCH/LinuxClusters/pka-putty.html

http://www.dailyiteration.com/howto-passwordless-ssh-authentication-with-putty/

http://blog.shvetsov.com/2010/03/making-pageant-automatically-load-keys.html+

Note that in order for SSH authentication to work, you often need to set your .ssh folder and authorized_keys file permissions to specific values. Here are settings that I used that worked:

drwx------   2 ayahya ayahya  4096 Jul 13 14:23 .ssh
-rw-r--r--  1 ayahya ayahya 875 Jul 13 14:23 authorized_keys

Your private keys should always NOT be readable/writable by anyone but you

-rw------- 1 ayahya ayahya  951 Jul 17 14:00 id_rsa