Skip to content

Instantly share code, notes, and snippets.

View rumble's full-sized avatar

Mike Rumble rumble

  • Facebook, Inc.
  • Menlo Park, California
View GitHub Profile
// 1: how could you rewrite the following to make it shorter?
if (foo) {
bar.doSomething(el);
} else {
bar.doSomethingElse(el);
}
// Attempt to make a drop-and-forget bunch of scripts that mimick some missing html5 goodies automatically
// Example:
// $(document).ready(function() {
// ProvideHtml5.autofocus()
// ProvideHtml5.datepicker()
// ProvideHtml5.forcenumber()
// })
var ProvideHtml5 = {
autofocus = function() {
var geo = navigator.geolocation || (window.google && google.gears && google.gears.factory.create('beta.geolocation'));
if (geo) geo.getCurrentPosition(displayLocation, handleError);
function displayLocation(position) {
position.coords.latitude;
position.coords.longitude;
position.coords.accuracy;
}
function handleError(error) {