Skip to content

Instantly share code, notes, and snippets.

View thiagoloureiro's full-sized avatar
🚗
Coding

Thiago thiagoloureiro

🚗
Coding
View GitHub Profile
public class UserRepository : IUserRepository
{
public List<User> SelectUser()
{
// Select
List<User> ret;
using (var db = new SqlConnection(connstring))
{
const string sql = @"SELECT Id, Name, Surname, Email, Phone, LastLogon, CreatedOn, ActivationCode, Login, Password, Token, LoginToken, CPF, Birth, ProfileImage, DeviceToken FROM [User]";
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Nancy.Owin;
namespace ArmAPI
{
public class Startup
{
public void Configure(IApplicationBuilder app)
{
private static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseKestrel()
.UseStartup<Startup>()
.UseUrls("http://+:88")
.Build();
public class RootObject
{
public string eventName { get; set; }
public EventData eventData { get; set; }
}
public class Artifact
{
public string permalink { get; set; }
public string fileName { get; set; }
public sealed class MessageBrokerModule : NancyModule
{
public MessageBrokerModule()
{
Get("/", args => "Service Status OK");
Post("/", args =>
{
var obj = this.BindAndValidate<RootObject>();
public class MessageBroker
{
private ConnectionFactory _factory;
private IConnection _connection;
private IModel _channel;
public string QueueName { get; set; }
public void Connect()
{
public class RabbitMq
{
private ConnectionFactory _factory;
private IConnection _connection;
private IModel _channel;
private EventingBasicConsumer _consumer;
public string QueueName { get; set; }
public RabbitMq(string queuename)
{
private static void Main()
{
Console.Clear();
Console.WriteLine("Raspberry Bot Started - Checking your builds");
Console.WriteLine("Connecting to RabbitMQ");
var objRabbit = new RabbitMQ.RabbitMq("AppVeyor");
objRabbit.Connect();
Console.WriteLine("Connected successfully with RabbitMQ!");
public void ConfigureServices(IServiceCollection services)
{
var database = "appmetricsdemo";
var uri = new Uri("http://127.0.0.1:8086");
services.AddMetrics(options =>
{
options.WithGlobalTags((globalTags, info) =>
{
globalTags.Add("app", info.EntryAssemblyName);
@thiagoloureiro
thiagoloureiro / SlackClient.cs
Created July 5, 2018 19:07 — forked from jogleasonjr/SlackClient.cs
A simple C# class to post messages to a Slack channel. You must have the Incoming WebHooks Integration enabled. This class uses the Newtonsoft Json.NET serializer available via NuGet. Scroll down for an example test method and a LinqPad snippet. Enjoy!
using Newtonsoft.Json;
using System;
using System.Collections.Specialized;
using System.Net;
using System.Text;
//A simple C# class to post messages to a Slack channel
//Note: This class uses the Newtonsoft Json.NET serializer available via NuGet
public class SlackClient
{