Skip to content

Instantly share code, notes, and snippets.

View devsuperman's full-sized avatar
🕺
.

Tiago Bernardo devsuperman

🕺
.
View GitHub Profile
@devsuperman
devsuperman / Startup.cs
Last active January 28, 2020 11:50
Exemplo de utilização do método de extensão de cultura brasileira
using Tambaqui.Extensions;
...
namespace Tambaqui
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
@devsuperman
devsuperman / AppExtensions.cs
Last active January 28, 2019 15:08
Método de extensão de cultura brasileira
using System.Globalization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Localization;
namespace Tambaqui.Extensions
{
public static class AppExtensions
{
public static IApplicationBuilder UsarCulturaBrasileira(this IApplicationBuilder app){
@devsuperman
devsuperman / gist:a884cff9f792a017898a3ef4c78956f0
Last active January 28, 2019 14:52
Método de extensão do jQuery para validar data e números em formato brasileiro
//Substitui o ponto pela virgula ao validar inputs decimais. Muito adequado para inputs de valor monetário.
$.validator.methods.range = function (value, element, param) {
var globalizedValue = value.replace(",", ".");
return this.optional(element) || (globalizedValue >= param[0] && globalizedValue <= param[1]);
};
$.validator.methods.number = function (value, element) {
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:[\s\.,]\d{3})+)(?:[\.,]\d+)?$/.test(value);
};