Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Renato E F renctx

🏠
Working from home
Block or report user

Report or block renctx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@renctx
renctx / Program.cs
Created Nov 10, 2017
Exemplo de criação de usuários
View Program.cs
using IdentityModel.Client;
using Newtonsoft.Json;
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
namespace Client
{
public class Program
@renctx
renctx / ExampleUsage.cs
Created Jul 24, 2017 — forked from NickCraver/ExampleUsage.cs
Code to mark a SQL string before it's passed to Dapper.
View ExampleUsage.cs
public static List<T> Query<T>(this DataContext db, string sql, object param = null, int? commandTimeout = null, IDbTransaction transaction = null, [CallerFilePath]string fromFile = null, [CallerLineNumber]int onLine = 0, string comment = null)
{
using (db.Connection.EnsureOpen())
{
try
{
return db.Connection.Query<T>(MarkSqlString(sql, fromFile, onLine, comment), param, transaction ?? db.Transaction, true, commandTimeout).AsDapperList();
}
catch (SqlException ex) when (ex.Is(SqlErrorCode.DatabaseReadOnly_3906))
{
View gist:40ad65a5037caf6b81af3dd1967feb40
using System;
using System.Collections.Generic;
using System.DirectoryServices.AccountManagement;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Thinktecture.IdentityServer.Core;
using Thinktecture.IdentityServer.Core.Models;
using Thinktecture.IdentityServer.Core.Services;
@renctx
renctx / AspNetWebFormsInvokeIdSrvChallenge.cs
Created Nov 18, 2015
AspNetWebFormsInvokeIdSrvChallenge
View AspNetWebFormsInvokeIdSrvChallenge.cs
if (!Request.IsAuthenticated)
{
HttpContext.Current.GetOwinContext().Authentication.Challenge(
new AuthenticationProperties
{
RedirectUri = "http://localhost:2671/Default"
},
OpenIdConnectAuthenticationDefaults.AuthenticationType);
}
View gist:6547266
var FunctionOne = function () {
var
a = $.Deferred(),
b = $.Deferred();
// some fake asyc task
setTimeout(function () {
console.log('a done');
a.resolve();
}, Math.random() * 4000);
View Demo-SignalR-MoverForma-Hub
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;
namespace DemoSignalR.Web.Hubs
{
[HubName("formaHub")]
public class FormaHub : Hub
{
public void MoverForma(int x, int y)
{
View Demo-SignalR-MoverForma
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>SignalR - Mover Forma</title>
<style>
#forma
{
width: 50px;
@renctx
renctx / gmaps.marker-extensions.js
Created Feb 25, 2013
recuperar lat e lng do google maps com marker draggable
View gmaps.marker-extensions.js
window.google.maps.Marker.prototype.getLat = function () {
var position = this.getPosition();
return position[Object.keys(position)[0]];
};
window.google.maps.Marker.prototype.getLng = function () {
var position = this.getPosition();
return position[Object.keys(position)[1]];
};
View SignalR Client Hub Call
using System;
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR.Client.Hubs;
namespace AsyncMessageSender
{
internal class Program
{
private const string PrivateKey = "bcf9f7ff-dd90-41ac-b737-dd0b93be3fc5";
private const string Url = "http://localhost:6398";
@renctx
renctx / async await sample c# 4.5
Created Sep 5, 2012
Exemplo de Async/Await C# 4.5
View async await sample c# 4.5
using System;
using System.Threading.Tasks;
namespace Exemplo.AsyncAwait
{
class Program
{
static void Main(string[] args)
{
Exec();
You can’t perform that action at this time.