Petar Strinic

and all those sorts of things…

While playing around with a weather widget, the other day, I though to myself why not use HTML5’s geolocation capabilities to show the user the weather for their current location automatically. This turns out to be exceedingly easy, if you’re willing to live with a couple of small assumptions, such as it’s safe to use a regular expression to parse the zip code out of Google Maps API’s formatted_address. Although they do offer a more specific “postal code” field as part of the address object, this is just a little quicker to get to, if you’re willing to assume a format like “, IL 60601”.

In easy steps…

1. Get the user’s latitude and longitude, we can do something like this:

2. Get the address information from Google maps and do the regex hack to get the zip out of the formatted_address.

Shady demo: http://petarstrinic.com/examples/whatIsMyZip.html

Share

April 7th, 2012

Posted In: Misc

Tags: , , ,

8 Comments

Dicey Wave Bot has been updated to utilize Google Wave API v2. No changes to the way it works.

Any suggestions for changes or new features?

Share

March 15th, 2010

Posted In: Projects

Tags: , , , , , ,

Leave a Comment

As any good geek would, when faced with something cool and new that also has a published API, I thought I’d see if I can write a quick dirty Google Wave Bot.

The purpose of this bot is to automate dice rolls for role playing games. It supports the typical 4d6+1 format, where 4 is the number of dice to roll, 6 is the number of sides each die has and 1 is the modifier to add to the total. It also supports multiple rolls, so you might do: 3d3+1 – 2d2, and it would return the individual rolls and the total of the 2 rolls.

You include it into your own wave by inviting diceywavebot@appspot.com

If you get some good use out of this bot, I’d love to hear about it. Also, let me know if you run into any bugs or have suggestions on making the bot better.

Share

November 1st, 2009

Posted In: Projects

Tags: , , , , , ,

4 Comments

Next Page »