Skip to content

Instantly share code, notes, and snippets.

Avatar

Aaron Ranard aaronranard

View GitHub Profile
@aaronranard
aaronranard / currency-validator.js
Last active Oct 27, 2016 — forked from chrisvfritz/currency-validator.js
Currency Validator to account for commas in input
View currency-validator.js
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 Jul 23, 2013 — forked from bradp/gist:4999343
WordPress: Address to Latitude / Longitude
View address-to-lat-long.php
<?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 );
You can’t perform that action at this time.