Factor Mystic

19Aug/090

Gmail Loading Screen hack

Here's a quick userstyle for the Gmail loading screen. You and apply it via Stylish. Edit: And a Chrome/Chromium extension!

It's takes you from boring...

Gmail Loading Screen (Before)

Gmail Loading Screen (Before)

...to moderately less boring!

Gmail Loading Screen (After)

Gmail Loading Screen (After)

It's cool how just centering the info and adding a logo spruces things up. Take the hint, Google!

Here's the code:

@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document domain("mail.google.com") {
  #loading {
    position: absolute;
    left: 50%;
    width: 400px;
    margin-left: -200px;
  }
  #loading .cmsg:first-child {
    background-image: url(https://mail.google.com/mail/images/2/5/logo1.png);
    background-position: left top;
    background-repeat: no-repeat;

    padding-top: 70px;
  }
  #stb {
    left:0px;
  }
}

Ideas to make it cooler? Leave a comment!

5Jul/090

Downtime

My web host was offline for the past few days after an unfortunate data loss, and I’m slowly restoring things from backup. Most of my utilities and other projects should be back up in a couple days, but the latest work on defaultprogramseditor.com is gone forever and I’ll have to just sit down and rewrite it. Finishing that site with screenshots and user documentation are pretty much all that’s left to do before the 2.0 release. No program code was lost at all, and the beta has been pretty successful and will probably be one of the last builds.

23Jul/08Off

How to run Ruby scripts in a browser without mod_ruby

I'm sure this is a horror in dozens of ways, but eruby sucks and my host doesn't have mod_ruby. So I got creative.

The .htaccess rewrites requests for any file ending in .rb to this handler.php, which confirms that the requested ruby script exists, then executes it and prints the result.

//PHP script to execute ruby scripts when the host doesn't have a cgi handler for .rb
//Use with this .htaccess:

/*
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.*)\.rb$ handler.php?rb=$1.rb [NC,QSA]
*/

$file = $_GET['rb'];

if(in_array($file, scandir('.')))
{
foreach($_REQUEST as $key=>$value) if($key != 'rb') $args .= " $key=".urlencode($value);
echo exec(escapeshellcmd('./'.$file.$args));
}
else
{
echo '404- Page not found';
}
?>

Here's an example ruby script using this hack- nothing special to do here at all:

#!/usr/local/bin/ruby

require 'cgi'

print "Hello from Ruby!<br>"
print "All of the input variables:<hr>"

ARGV.each do |arg|
print CGI::unescape(arg.to_s)
print "<br>"
end

All the GET, POST, and COOKIE variables are at your fingertips in ARGV! (You could get them with Ruby's CGI module as well.)

So here's what it looks like to users:

Screenshot of ruby without mod_ruby hack

Screenshot of ruby without mod_ruby hack