This file contains 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
class BrazilRegion | |
{ | |
constructor() { | |
this.States = [ | |
{ | |
Uf:'RO', | |
Name:'Rondônia' | |
}, | |
{ | |
Uf:'AC', |
This file contains 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
using System; | |
using System.Configuration; | |
using System.Web; | |
namespace Custom.Helpers.Common | |
{ | |
public static class Cookie | |
{ | |
private const string CookieSetting = "Cookie.Duration"; | |
private const string CookieIsHttp = "Cookie.IsHttp"; |
This file contains 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
// Changes XML to JSON | |
// Modified version from here: http://davidwalsh.name/convert-xml-json | |
function xmlToJson(xml) { | |
// Create the return object | |
var obj = {}; | |
if (xml.nodeType == 1) { // element | |
// do attributes | |
if (xml.attributes.length > 0) { |
This file contains 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 unmask(val) { | |
return val.replace(/\D+/g, ''); | |
} | |
function formatDate(ev) { | |
console.log(ev.value); | |
var cleanText = unmask(ev.value); | |
var result = cleanText; | |
if (cleanText.length > 2) { |
This file contains 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
jQuery.validator.addMethod("cnpj", function (value, element) { | |
var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais; | |
if (value.length == 0) { | |
return false; | |
} | |
value = value.replace(/\D+/g, ''); | |
digitos_iguais = 1; |
This file contains 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 to prepare the youtube embeded Url to use in iFrame src | |
$scope.trustSrc = function(src) { | |
var url = src.replace("watch?v=", "embed/"); | |
url = src.replace("youtu.be/", "youtube.com/embed/"); //if cpied link by youtube app | |
return $sce.trustAsResourceUrl(url); | |
} | |
//validate a youtube Url | |
$scope.validateYoutubeUrl = function (url) | |
{ |
This file contains 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
public String calculeDistance(){ | |
String distance = null; | |
double earthR = 6371; | |
double lati = Math.PI/180*(mMyLatitude - mPoi.getPoiLatitude()); | |
double longi = Math.PI/180*(mMyLongitude - mPoi.getPoiLongitude()); | |
double a = | |
Math.sin(lati/2) * Math.sin(lati/2)+ | |
Math.cos(Math.toRadians(mPoi.getPoiLatitude())) * Math.cos(Math.toRadians(mMyLatitude)) * | |
Math.sin(longi/2) * Math.sin(longi/2); |
This file contains 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
SQRT( | |
POW(69.1 * (latitude - [startlat]), 2) + | |
POW(69.1 ([startlng] - longitude) * COS(latitude / 57.3), 2)) AS distance | |
FROM TableName HAVING distance < 25 ORDER BY distance; |