This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function InitsWithProps<T extends {new(...args: any[]): {}}>(constructor: T) { | |
return class extends constructor { | |
constructor(...args: any[]) { | |
super(...args); | |
if (args && args.length) { | |
Object.assign(this, args[0]); //args[0] must be an object | |
} | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// route is a DirectionsRoute interface | |
// see: https://developers.google.com/maps/documentation/javascript/reference/directions#DirectionsRoute | |
function getRouteStates(route) { | |
let states = [], | |
routeLeg = route.legs[0] // first leg of the route is the starting point | |
states.push( | |
routeLeg.start_address | |
.split(',') // split on commas |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm config set script-shell "C:\\Program Files\\Git\\bin\\bash.exe" | |
//or | |
npm config set script-shell "C:\\Program Files (x86)\\git\\bin\\bash.exe" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$addr = 'Columbus,OH,43235'; | |
$maps_api_key = 'insert key here'; | |
/** | |
* Gets the timezone id (eg. America/New_York, America/Detroit) | |
* @param string $address | |
* @return string|bool | |
*/ | |
function get_timezone_from_address($address){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$address = 'avenida+gustavo+paiva,maceio,alagoas,brasil'; | |
$geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address='.$address.'&sensor=false'); | |
$output= json_decode($geocode); | |
$lat = $output->results[0]->geometry->location->lat; | |
$long = $output->results[0]->geometry->location->lng; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function nf_grecaptcha_explicit_render(){ | |
jQuery('.g-recaptcha').each(function(){ | |
var sitekey = jQuery(this).data('sitekey'); | |
grecaptcha.render(this, { | |
'sitekey':sitekey | |
}) | |
}); | |
} |