Upside Down

Convert text to appear upside-down with this simple JavaScript function. ...

April 19, 2013 · 1 min · ArtBIT

Handy Bookmarklets

Here’s a couple of bookmarklets that I use regularly when developing web apps. I’ll add more to the list as I go. Adds the specified javascript file to the current page. javascript:(function(){var%20sUrl=prompt('Enter the URL for the script file to inject:');if(sUrl){var%20s=document.createElement('script');s.setAttribute('src',sUrl);document.getElementsByTagName('body')[0].appendChild(s);alert('Script%20injected!');}})(); Adds the specified css stylesheet file to the current page. javascript:(function(){var%20sUrl=prompt('Enter%20URL%20to%20Stylesheet');if(sUrl){var%20s=document.createElement('link');s.setAttribute('href',sUrl);s.setAttribute('rel','stylesheet');s.setAttribute('type','text/css');document.getElementsByTagName('head')[0].appendChild(s);alert('Stylesheet%20injected!');}})(); Parses the page and shows the list of all the colors used on the page. javascript:(function(){s=document.body.appendChild(document.createElement('script'));'fs';s.language='javascript';void(s.src='');})()

January 13, 2012 · 1 min · ArtBIT

Obscure JavaScript

My colleague, pasted an interesting javaScript idiom to our developer chat, some time ago, and it immediately caught my attention. If you cast an array literal to a number, prepending it with a ‘+’ operator, it will evaluate to 0. var a = +[]; // a is 0 Heh, something so logical, yet obscure, immediately inspired me to take this a bit further. ...

September 13, 2011 · 3 min · ArtBIT