Sunday, 8 May 2011

Dynamcially adding style

Dynamically add style to a page...

var style = "body{color:#666;}";
var s = document.createElement('style');
s.setAttribute("type", "text/css");
if (s.styleSheet) { // IE
s.styleSheet.cssText = style;
} else {
var stxt = document.createTextNode(style);
s.appendChild( stxt );
}
document.getElementsByTagName('head')[0].appendChild(s);

Remember to minify the style text using something like http://refresh-sf.com/yui/

Monday, 4 April 2011

'require': no such file to load -- sqlite3/sqlite3_native (LoadError)

When running "rails server" I was getting the following error...
'require': no such file to load -- sqlite3/sqlite3_native (LoadError)


Banging my head on the desk for ages with this one. Then realised the default Aptana workspace name contained white space chars! Remove these and all is fine.

Shame on me!
 

Note: the opinions on this page don't represent that of my employer in anyway. And, actually only vaguely represent my opinions on the date of publication. (Unlike Ms T, I am very much for turning)