tutorial

Best jQuery Book Ever

An absolutely awesome jQuery book: http://jqueryenlightenment.com/

It's this simple: if you are a Web developer, you need this. And you will support the project. And PDF version is dirt-cheap.

Your First jQuery Plugin

We all have come to love and admire jQuery for the amazing Javascript library it is. But we also have fallen in love with numerous extensions to jQuery; plugins, modules - whatever you call 'em. Most of us, however, just use these goodies and bless the hearts of all wonderful people who make the gems available. Some of us are even a little bit intimidated when we look at all the complicated Javascript-ing going on in the source files... Especially when/if we accidentally look into a minified version ;)

Jokes aside, starting a new jQuery plugin is quite simple. Here is just how easy one could be:

(function($) { 

	// jQuery plugin initialization
	$.fn.irakli = function(conf) {   
		alert("okaaaay");		
	}; 
	
})(jQuery);

This goofy plugin will allow you to invoke irakli() function on a jQuery object. For instance, $('div.something').irakli() will have an alert box pop up.

Installing Webmin Securely with SSL on CentOS 5.2

# yum install openssl
# yum install openssl-devel
# yum install perl
# yum install perl-Net-SSLeay perl-Crypt-SSLeay
# rpm --import http://www.webmin.com/jcameron-key.asc

Create the /etc/yum.repos.d/webmin.repo file containing :

[webmin]
name=Webmin Distribution Neutral
baseurl=http://download.webmin.com/download/yum
enabled=0

Then run:

# yum --enablerepo=webmin install webmin

Check installation success with:

/etc/init.d/webmin status

If everything is good and webmin is running access it via:
https://yourdomain.com:10000/

Chrooted FTP Access

FTP is an insecure, outdated and overall horrible protocol that you should never use yourself. Yet, sometimes you want to allow some people to upload files to your server, but you don't want them poking around your server or users demand FTP because they are used to it and have no idea what SSH/SFTP is.

Either way, following is how you "chroot" ftp users to their home folder, so they can't do any harm:

  • Download latest proftpd source to /usr/local/sources and change to that folder.
  • ./configure --sysconfdir=/etc --localstatedir=/var
  • make
  • make install
  • Edit vi /etc/proftpd.conf:
    • Change "Umask 022" to "Umask 002" #So, files they upload are group-writable
    • Uncomment "DefaultRoot ~" # this does actual chrooting
  • Make sure "/bin/false" is listed among the shells in "/etc/shells"
  • Create new unix user with "-s /bin/false"
  • Start proftpd daemon

Recursively Removing Subversion Files

More often than we'd like to acknowledge we get a need to remove Subversion .svn files in the working copy.

This will do it:

find . -name .svn -print0 | xargs -0 rm -rf 

Setting Up Subversion in 5 minutes

There are several books about Subversion, some small some huge. Yet, none of them gives a 5 minute get-going guide. Most of the developers are seasoned CVS users, so we do not really need a tirade about version control - just get us going!

And (I can hardly stress this enough) we\'d really like Subversion to authenticate over SSH. Leave that "pasword db" (in essence - open text file) or Apache Module bullcrap, to somebody else. Neither do we need the WebDav for version control - thank you very  much, but no.

The last time I set up a SVN repository (accidentally - my first time, too) it took me looking through 4 different books and a week\'s work on and off. Today I needed to do it, again and I found out that I did not remember much of the last experience. Well, it did not take me a week, but still more than I would want to spend on it. Anyway, to save myself time, in the future and in hopes of this being useful for folks who don\'t want to read 4 books, here is how it is done, on Unix (Windows can get lost, as far as I care):

Syndicate content