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 |
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; |
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; |
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"; |
View async await sample c# 4.5
using System; | |
using System.Threading.Tasks; | |
namespace Exemplo.AsyncAwait | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Exec(); |
NewerOlder