I can't stop thinking about these little yellow boxes…

I just created an Annotations spin-off of GreasyThug. This doesn’t have an interactive console, or use Gears. It does let you add comments to any web page in any location, for all the world (who have installed the script) to see.

Take a look at this page after installing it, and leave some annotations of your own.

GreasyThug – Greasemonkey, Gears and jQuery

I’ve been called a greasy thug, too. It never stops hurting. So here’s what we’re gonna do: We’re gonna grease ourselves up real good and trash that place with a baseball bat. – Homer

Presenting: GreasyThug

Here’s my problem, I want to develop Greasemonkey scripts. This doesn’t sound like a problem, but JavaScript has a certain terribleness to it, at least in its current browser implementations, and I can never go back to raw JS, NEVER. I’ve also grown accustom to having an interactive console for development and debugging, but Firebug doesn’t have access to Greasemonkey code. And another thing, shouldn’t I be able to make changes to a page, on the fly, and have them persist, without having to dig out my scripts and modify them? Shouldn’t every website be using Gears by now? Wouldn’t it be great to be able to use jQuery in your browser console on every website you go to?

Fact: GreasyThug will make all of your wildest dreams come true.

GreasyThug – Interactive JavaScript Console Features

  • Built in jQuery functionality.
  • Google Gears included.
  • A persistent command history across page reloads and browser restarts.
  • Drag and drop – remembers where you put it for each site.
  • Ability to persist micro-scripts and apply them automatically everytime you visit the page.

Warning! GreasyThug is slick (it’s the grease) and dangerous (it’s a thug). An interactive console is essentially a pipe straight into eval(). So… BE CAREFUL! If your thug becomes compromised it will be your house that gets trashed with a baseball bat. Remember, this is eval in the elevated Greasemonkey privilages context, its strength for development is also its weakness for security.

Prerequisites

Demonstration

Let’s spruce up the google search page. Maybe we should make a whole Greasemonkey user script? Nah, that’s a huge hassle now that we already have GreasyThug.

  1. Go to Google.com
  2. A “The website below wants to store information on your computer using Gears” security warning will pop up, as it will do for everydomain that you have GreasyThug enabled for. It’s not really the website using Gears, though some might eventually. Click “Allow”. (This is how the command history and micro-scripts are saved).
  3. Now let’s get cracking! Drag the interactive console to a comfortable location. (It will begin in the top left by default)greasy_thug-1
  4. Execute some JavaScript statements to get a feel for it. No need for semicolons, we’re not chumps.
  5. Now on to the cool stuff: that white background is a little bland for Valentine’s Day, let’s spice it up. Pop this into your console:
    $('body').css('background-color', '#F8A')

    greasy_thug-03 It’s beautiful! See how I can use jQuery? Neat! Also, the up arrow populates the input with my previous command.

  6. Maybe it’s not quite as good looking as I thought, probably best to stick with white… let’s just refresh and forget about this debacle. greasy_thug-04 Back to normal… but the history remembered my command in case I want to try it again.
  7. It is my strong belief that there should be a link to STRd6 right next to everyone’s email address on the Google search page. Obviously this should only be for logged in users… I can only change it for myself though…
    $('#gb nobr').prepend($('STRd6'))
  8. But what about when I refresh… it’ll disappear and all that hard work will be gone?!? Not so good friend:
    savePrevious()

    This will store whatever command you last executed to be executed again when you return. You can save many commands. These are those micro-scripts that you’ve been hearing so much about and they are the future.greasy_thug-06

So is this the end? It is for today. Now imagine sharing micro-scripts with your friends. It’s our internet now. It just takes some elbow grease and a little thuggery.

Feature requests go in the comments.

Microsoft Loves Firefox

Today at work Sharepoint was blocking access to Internet Explorer. Something like about:protectedmodeoff. I could look into it, do some searches and figure it out. But it was just quicker to tell anyone affected to download Firefox Portable, which worked.

Another interesting feature: when connecting to the Exchange server in IE it automatically logs in to your email. Which is great until you want to log in to access a different in-box, because you can never log out… EVER! Oops, Firefox time again.

Mathematical Image Example for Ruby Quiz #191

This image was generated as an example for Ruby Quiz
This image was generated as an example for Ruby Quiz

This weeks quiz is about generating images from mathematical functions. Here is an example to see what I’m talking about.

depth: 3
red: Math.sin(Math::PI * Math.cos(Math::PI * y * x))
green: Math.sin(Math::PI * (Math.sin(Math::PI * y)) ** 3)
blue: (Math.cos(Math::PI * Math.cos(Math::PI * y))) ** 3

See the full quiz here: http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/327126

Onion Eyes

The onion reminds me of my frailty. This simple vegetable brings me to tears and there is nothing I can do about it. It’s easy to forget how fragile I am. The best technology can do is to hide my vulnerability; the worst is to allow me to forget it’s truth.

Billions of years of serendipity have allowed me the grace of existence in this world. Meanwhile it is all I can do to rise slightly above the chaos, knowing the whim of chance can take it all away. I come from a long evolutionary line of stupendous bad-asses. So do onions. All the denizens of this world do. Except for the most powerful; they come from nothing, and are all around us.

The onion reminds me to strive for clarity. To persist through the fog. To try harder. I now have a delicious dinner.

i see _why, he wanted one in his book

The Chasm of Compromise

You and your friend are trying to decide whether or not to jump across a chasm. You want to jump across to the other side where you will be rewarded with delicious berries. You friend wants to stay put and eat the so-so berries here. So you decide to compromise: you each jump halfway across the chasm and die.

Not all situations are chasms, but the really important ones usually are. Compromise can kill you; go for consensus if you can. If you can’t, go alone.

25 Random Things About Me

  1. I love programming, computer science, data-structures and algorithms.
  2. I type using the Dvorak keyboard layout and my keyboard hasn’t jammed once. In your face QWERTY!
  3. My favorite sport is soccer.
  4. I’ve programmed two Facebook Apps (http://apps.facebook.com/telepictionary/ )
  5. One of my favorite jokes is about putting a moratorium on hiatus.
  6. My nose was once broken playing soccer (8 days before getting married).
  7. I’m married.
  8. I work for a bio-tech startup in San Diego, Stemgent, and have created most of the application logic for the commerce portion of the website (www.stemgent.com).
  9. I read a bunch of blogs, Google tells me: From your 16 subscriptions, over the last 30 days you read 640 items, starred 18 items, shared 7 items, and emailed 3 items
  10. I have a blog ( http://strd6.com )
  11. I used to be a professional gambler.
  12. I can’t whistle and can barely snap.
  13. I’m fast.
  14. The first programming language I learned was FORTRAN.
  15. I know more about web programming than a sane person would care to admit but still need to know so much more.
  16. I don’t like bananas, but I don’t mind food that contains bananas or even banana chips.
  17. I’ve created a turn based, tactical combat board game.
  18. I’m bi-modal about Magic: The Gathering (trading card game) and JavaScript (programming language).
  19. I’ve programmed a text adventure game based on Edgar Allen Poe’s Cask of Amontillado.
  20. I don’t have cable TV.
  21. I like to pretend I don’t read so as to appear cool.
  22. I like esoteric sketch comedy (Mr. Show, The Ben Stiller Show).
  23. I lead a frugal lifestyle.
  24. I skipped a lot of classes in college to write a play: Hamlet on The Moon (http://strd6.com/wp-content/uploads/2009/01/hamlet-on-the-moon.pdf) Couldn’t have done it without Graham.
No explanation needed
No explanation needed

A Whack on the Side of the Head

I found out about this book in a seemingly unlikely place, Mark Rosewater’s design column Making Magic. Not that unlikely for me though because Mark Rosewater is one of my heroes. I enjoy reading almost every one of his columns. His writing on elegance and the many other aspects of design is applicable to all matters of thought engineering.

What’s all this gassing on about some trading card game designer, isn’t this an internet programming blog? This brings me to my point:

That’s Not My Area

Some of the biggest breakthroughs come from the cross-pollination of ideas: what does orange farming have in common with a web application? What does biology have in common with computation?

The Right Answer

Nothing is more dangerous than an idea when it is the only one we have.

Believing that there is only one right answer can be incredibly stiffling to creativity. Settling for the first answer that works will get you part way there as a programmer, but how often is the first answer the best answer?

Follow the Rules

Sacred Cows make great steaks. — Richard Nicolosi, Businessman

Just because an idea was absolutely right in the past doesn’t mean that it is guaranteed to be right today. The qwerty keyboard layout was designed to prevent typewriter jams by slowing down the typist. When was the last time you experienced a jam on your keyboard? How about repetitive stress injury? Problems change with the times.

To Err is Wrong

A man’s errors are his portals of discovery. — James Joyce

Software development is about making errors… constantly. If know a developer who isn’t making any errors then he isn’t writing any programs. How many things do you learn when everything appears to work? It often takes 50 errors to get to the first right answer and 5000 more to get to one of the best answers.

Roger von Oech’s A Whack on the Side of the Head has a list of ten mental locks that can prevent creativity. There’s a whole lot more in the book than just that though. So go ahead, read it.