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 IdentityModel.Client; | |
using Newtonsoft.Json; | |
using System; | |
using System.Net.Http; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace Client | |
{ | |
public class Program |
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
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)) | |
{ |
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; | |
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; |
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
if (!Request.IsAuthenticated) | |
{ | |
HttpContext.Current.GetOwinContext().Authentication.Challenge( | |
new AuthenticationProperties | |
{ | |
RedirectUri = "http://localhost:2671/Default" | |
}, | |
OpenIdConnectAuthenticationDefaults.AuthenticationType); | |
} |
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
var FunctionOne = function () { | |
var | |
a = $.Deferred(), | |
b = $.Deferred(); | |
// some fake asyc task | |
setTimeout(function () { | |
console.log('a done'); | |
a.resolve(); | |
}, Math.random() * 4000); |
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 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) | |
{ |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width" /> | |
<title>SignalR - Mover Forma</title> | |
<style> | |
#forma | |
{ | |
width: 50px; |
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
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]]; | |
}; |
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; | |
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"; |
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; | |
using System.Threading.Tasks; | |
namespace Exemplo.AsyncAwait | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Exec(); |
NewerOlder