Skip to content

Instantly share code, notes, and snippets.

View aaronranard's full-sized avatar

Aaron Ranard aaronranard

View GitHub Profile
@aaronranard
aaronranard / currency-validator.js
Last active October 27, 2016 14:45 — forked from chrisvfritz/currency-validator.js
Currency Validator to account for commas in input
var currencyValidator = {
format: function (number) {
return (Math.trunc(number * 100) / 100).toFixed(2)
},
parse: function (newString, oldNumber) {
var CleanParse = function (value) {
return { value: value }
}
var StringParse = function (string) {
return parseFloat(string.replace(/,/g, ''))
@aaronranard
aaronranard / address-to-lat-long.php
Created July 23, 2013 15:13 — forked from bradp/gist:4999343
WordPress: Address to Latitude / Longitude
<?php
function brrad_geocode($street_address,$city,$state){
$street_address = str_replace(" ", "+", $street_address); //google doesn't like spaces in urls, but who does?
$city = str_replace(" ", "+", $city);
$state = str_replace(" ", "+", $state);
$url = "http://maps.googleapis.com/maps/api/geocode/json?address=$street_address,+$city,+$state&sensor=false";
$google_api_response = wp_remote_get( $url );