Skip to content

Instantly share code, notes, and snippets.

View jean-lourenco's full-sized avatar
📦
resolving binding redirects

Jean Lourenço jean-lourenco

📦
resolving binding redirects
View GitHub Profile
@jean-lourenco
jean-lourenco / timer.cs
Created September 28, 2020 16:46
IHostedService com Timer
public class ContractUpdated : IHostedService, IDisposible
{
private Timer _timer;
public Task StartAsync(CancellationToken token)
{
_timer = new Timer(
UpdateContracts,
null,
TimeSpan.Zero,
@jean-lourenco
jean-lourenco / di.cs
Created September 28, 2020 16:35
Linha para adicionar serviço no DI
services.AddHostedService<TimedHostedService>();
@jean-lourenco
jean-lourenco / IHostedInterface.cs
Created September 28, 2020 16:34
Interface básica no IHostedService
public class ContractUpdated : IHostedService
{
public Task StartAsync(CancellationToken token)
{
return Task.CompletedTask;
}
public Task StopAsync(CancellationToken token)
{
return Task.CompletedTask;
@jean-lourenco
jean-lourenco / gist:c45ff98e75b8fb0b2f68aa26e1ec1247
Created January 30, 2018 12:02
DTO de exemplo do GET api/v1/CartaoDebito/ListaCartoesVinculados
public class CartaoNaListagemDto
{
public long Id { get; set; }
public string NomeNoCartao { get; set; }
public string QuatroUltimosNumeros { get; set; }
}
@jean-lourenco
jean-lourenco / gist:b91beac1cd81fecea29d92adedce07d7
Created January 30, 2018 11:40
DTO de retorno do GET api/v1/CartaoDebito
public class CartaoDebitoDto
{
public long Id { get; set; }
public long CartaoId { get; set; }
public string Nome { get; set; }
public string Documento { get; set; }
public string Email { get; set; }
public DateTime? DataUltimaRecarga { get; set; }
public decimal? ValorUltimaRecarga { get; set; }
public DateTime DataVencimentoUltimaRecarga { get; set; }
using System;
namespace coisas
{
public class Program
{
public static void Main(string[] args)
{
var total = 0;
var impares = 0;
@jean-lourenco
jean-lourenco / index.html
Created May 10, 2017 02:46
Test any websocket endpoint
<html>
<head>
<title>r/place clone</title>
</head>
<body>
<input type="text" value="" id="message" />
<input type="button" value="Send" onclick="send()" />
<div id="container"></div>
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using Dapper;
using Microsoft.EntityFrameworkCore;
using ServiceStack.DataAnnotations;
using ServiceStack.OrmLite;
using System;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
BenchmarkDotNet=v0.10.3.0, OS=Microsoft Windows NT 6.2.9200.0
Processor=Intel(R) Core(TM) i7-6500U CPU 2.50GHz, ProcessorCount=4
Frequency=2531250 Hz, Resolution=395.0617 ns, Timer=TSC
  [Host]     : Clr 4.0.30319.42000, 32bit LegacyJIT-v4.6.1637.0
  DefaultJob : Clr 4.0.30319.42000, 32bit LegacyJIT-v4.6.1637.0

@jean-lourenco
jean-lourenco / ormlite.cs
Last active April 10, 2017 14:59
Exemplo de utilizaçãodo ORMLite, da ServiceStack
public static void Main()
{
var paraCadastrar = new TipoTransformacao[]
{
new TipoTransformacao{ Chave = "CSVDEFAULT", Descricao = "Descrição detalhada (ou não)" },
new TipoTransformacao{ Chave = "JSONDEFAULT", Descricao = "Descrição detalhada (ou não)" },
new TipoTransformacao{ Chave = "YAML", Descricao = "Descrição detalhada (ou não)" },
new TipoTransformacao{ Chave = "INIT", Descricao = "Descrição detalhada (ou não)" },
new TipoTransformacao{ Chave = "CONFIG", Descricao = "Descrição detalhada (ou não)" },
new TipoTransformacao{ Chave = "BSON", Descricao = "Descrição detalhada (ou não)" },