Jon Aquino's Mental Garden

Engineering beautiful software jon aquino labs | personal blog

Tuesday, May 21, 2013

zsh tip of the day

I've been getting into the zsh shell as a replacement for bash. But there are so many things to learn that I wanted a "Tip of the Day" to give me a random tip whenever starting my shell. The tips are from zsh-lovers.

So I made a tip-of-the-day script. Simply put these two files in ~/tips, then add php ~/tips/tips.php to your .zshrc file.

tips.php

tips.txt

The next time you start up your shell, you will see something like:

--------------------------------------------------------------------------------
zsh tip of the day

# Match file names containing only digits and ending with .xml (require
# *setopt kshglob*)
$ ls -l [0-9]##.xml
$ ls -l <0->.xml
--------------------------------------------------------------------------------

Sunday, May 19, 2013

Need to memorize a bunch of words?

Need to memorize a bunch of words? Try taking their initials and making an words out of them using the Internet Anagram Server.

Unlike some other online services which generate the largest single word out of all your letters (and often not hitting all of your letters), this one will generate several words that together try to use up all your letters.

For example, acdefiopstvwy gives Decaf Tipsy Vow.

Decaf Tipsy Vow helps you to memorize the following list of negative feelings:

  • Disconnected
  • Embarrassed
  • Confused
  • Averse
  • Fatigued
  • Tense
  • Impatient
  • Pain
  • Shocked
  • Yearning
  • Vulnerable
  • Outraged
  • Worried

Similarly, Jag Chef Trip helps you to memorize the following list of positive feelings:

  • Joyful
  • Affectionate
  • Grateful
  • Confident
  • Hopeful
  • Excited
  • Fascinated
  • Thrilled
  • Refreshed
  • Inspired
  • Peaceful

Saturday, May 18, 2013

BookFinder

Life-changing website: bookfinder.com. It finds the lowest used price for any book, searching a variety of online used bookstores. Best of all, the prices include shipping. I just ordered a book - would have cost $21 new, but got an older edition for $6.

Friday, May 17, 2013

Unclosed Tag Finder

Here is a tool to find unclosed tags in your HTML. Just paste in your HTML and press Submit. You will see a result like "Closing tag </table> on line 188 does not match open tag <td> on line 62.".


Results




Thursday, May 16, 2013

The Facebook Like Bug

I'll be honest - there are certain kinds of debugging that stress me out - such as when the bug is intermittent. One example is a bug that I've been looking at for the past day and a half: for quite a while, our users have been finding that Facebook Like buttons aren't working on their sites. They click Like and the popup appears for a second before disappearing. And it doesn't happen all of the time.

Well, we finally carved out some time this week to take a look at the issue. And yes, I could reproduce it yesterday. So I did my tried and true method of "deconstruction", in which I keep taking things away from the page until the problem stops. Well, I whittled the page down to just the Facebook Like snippet and it was still happening. So it was something to do with the URL we were giving to the Like button.

And then I couldn't reproduce it anymore.

Anyway, I was able to reproduce it again today. I put a bunch of Like buttons on a page: some that worked, some that didn't. And I eventually got it so that the only difference was that the Like buttons that didn't work had URLs that redirected to another URL.

By the way, throughout this saga, I was trawling the Facebook Bug Database and Stack Overflow for a silver bullet - someone who fixed the problem and here are the steps. I couldn't find any silver bullet, but it was still valuable because I heard mention of the Facebook Debugger, which sometimes fixes things when you put a URL through it because it clears Facebook's cache.

I tried putting my URL into Facebook's Debugger but it didn't fix my Like button. But I took a second look at the debugger results, and 'lo, there were some warnings about missing OpenGraph tags. I browsed around a bit and found that three of those tags are required (og:type, og:url, and og:title). So I put those tags on my page and...

yes...

the problem was fixed! Yay!

Wednesday, May 08, 2013

What's on your dock?

Tell me what's on your Mac OSX dock. These are the apps that you value the most.

Here's what's on my dock right now:

  • Finder
  • PostBox
  • Calendar
  • Adium
  • Notational Velocity
  • jEdit
  • iTerm2
  • Safari
  • Firefox
  • 1Password
  • Network Connect
  • Colors
  • Clock Chimes
  • iTunes
  • App Store
  • System Preferences
  • Microsoft Excel

Useful Git tool: tig

Here's a great article describing a useful Git tool called tig.

One thing it doesn't mention is that you can actually press comma (,) when doing a tig blame, to do a blame on the parent commit. This is useful if the blame on the current commit isn't showing who really changed the line. You can do blame on the line all the way up the parent tree.

Other tig tips:

  • Use this to browse the tree of another branch: tig origin/rel-1.5.
  • If while browsing the commits on another branch you press Shift+C on a commit, it will cherry-pick it into your current branch.

Sunday, May 05, 2013

Ideas for what to write in cards

Here's a great list of ideas for what to write in a card, if you're stuck for ideas. From Hallmark.