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
<?php | |
header('Content-Type: text/html; charset=utf-8'); | |
ini_set('default_charset','UTF-8'); | |
function acentuacao_assunto($string){ return '=?UTF-8?B?'.base64_encode($string).'?='; } | |
//https://vasconcellossolutions.com | |
//https://vasconcellos.site | |
$emailrecipient = "contact@corporation.com"; | |
$senderemail = $_POST['email']; | |
$sender = $emailrecipient; | |
$name = $_POST['name']; |
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
UPDATE wp_options | |
SET option_value = REPLACE(option_value, 'http://EnderecoAntigo.com', 'http://EnderecoNovo.com') | |
WHERE option_name = 'home' | |
OR option_name = 'siteurl'; | |
UPDATE wp_posts | |
SET guid = REPLACE (guid, 'http://EnderecoAntigo.com', 'http://EnderecoNovo.com'); | |
UPDATE wp_posts | |
SET post_content = REPLACE (post_content, 'http://EnderecoAntigo.com', 'http://EnderecoNovo.com'); |
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
static class VerificarPlacaMercoSul | |
{ | |
public int VerificarPlacaMercoSul(string placa){ | |
if(placa?.Count() != 7) return -1; | |
//Verifica se o último caractere é um número; | |
if(!Regex.IsMatch(placa[placa.Count()-1].ToString(), @"^(|[0-9])+$")) return -2; | |
//Verifica se a placa contempla apenas letras e números; | |
if(!Regex.IsMatch(placa, @"^([a-zA-Z]|[0-9])+$")) return -3; | |
return 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
void Main() | |
{ | |
Task<DayOfWeek> tarefa = new Task<DayOfWeek>(delegate() { return DateTime.Today.DayOfWeek; }); | |
// A continuacao. Seu delegate toma a tarefa antecedente | |
// como um argumento e pode retornar um tipo diferente | |
Task<string> continuacao = tarefa.ContinueWith((antecedent) => | |
{ | |
return String.Format("Hoje é {0}.",antecedent.Result); | |
}); |
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
//Programmed in LINQPad 5 | |
void Main() | |
{ | |
var result = EnumExtension.EnumToDictonary<CivilStatusEnum>(); | |
Console.WriteLine(result); | |
} | |
public static class EnumExtension | |
{ | |
public static Dictionary<int, string> EnumToDictionary<T>() where T : struct |
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
/// <summary> | |
/// DictionaryError | |
/// </summary> | |
/// <remarks> | |
/// Classe responsável por gerar o dicionário de erro da regra de negócio igual ao dicionário de erro do FluentValidation.AspNetCore. | |
/// </remarks> | |
internal static class ErrorDictionary | |
{ | |
internal static Dictionary<string, string[]> GenerateError(string parameter, string message, Dictionary<string, string[]> dictionaryErrors = null) | |
{ |
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.Collections.Generic; | |
public class ErrorDetails | |
{ | |
public ErrorDetails(Dictionary<string, string[]> errorsDictionary, string instance) | |
{ | |
this.Errors = errorsDictionary; | |
this.Type = "Business Rules"; | |
this.Title = "One or more validation errors occurred."; | |
this.Status = 422; | |
this.Detail = "Please refer to the errors property for additional details."; |
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
void Main() | |
{ | |
Process(); | |
} | |
delegate double MathAction(double num); | |
private static void Process() | |
{ | |
//--DELEGATE - COMMON--INITIAL |
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.Collections.Generic; | |
using System.Linq; | |
public class Result<T> | |
{ | |
public Result() | |
{ | |
this.Errors = new Dictionary<string, string[]>(); | |
} |
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
/// <summary> | |
/// Realiza a consulta por id do carro | |
/// </summary> | |
/// <param name="id"></param> | |
/// <response code="200">Ok</response> | |
/// <response code="400">Bad Request</response> | |
/// <response code="404">Not Found</response> | |
/// <response code="500">Internal Server Error</response> | |
[HttpGet("{id}")] | |
[ProducesResponseType(typeof(IList<CarModel>),200)] |
OlderNewer