Amazing one-liners

Sometimes it truly is amazing what you can do in simply one line of code. This blog post here will be a place where I keep a list of truly amazing and powerful one liners that can do incredibly useful and powerful things.

JavaScript (and jQuery)

// All links starting with http will get a rel=nofollow attribute added, 
// but ignore any links that already have 'rel' attributes.

$('a:not([rel])[href^="http"]').attr('rel','nofollow')

Please also share in the comments section if you know of any good ones worth adding. Any programming language is fine!

Mike K.

Mike is a front end web developer and marketing specialist. He enjoys writing about the internet, technology, finance, investing and health related topics.