This file contains hidden or 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
let oldDigest = GlobalServices.rootScope.$digest; | |
GlobalServices.rootScope.$digest = function () { | |
let stack = (<any>Error()).stack; | |
let t = new Date().getTime(); | |
oldDigest.call(this); | |
t = new Date().getTime() - t; | |
if (t > 250) { | |
console.log(`$digest: ${t} ms`) | |
console.log(stack); | |
} |
This file contains hidden or 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.Web.Http; | |
using System.Web.Http.Controllers; | |
using System.Web.Http.ValueProviders; | |
using System.Web.Http.ValueProviders.Providers; | |
using System.Globalization; | |
using System.Net.Http; | |
using System.Web.Http.ModelBinding; |
This file contains hidden or 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.Globalization; | |
using System.IO; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.AspNet.Identity; | |
using Microsoft.Owin.Security.DataProtection; | |
/// <summary> | |
/// Token provider that uses an IDataProtector to generate encrypted tokens based off of the security stamp |
This file contains hidden or 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
// https://en.wikipedia.org/wiki/Date_format_by_country | |
// MM/DD/YYYY USA | |
// DD/MM/YYYY Great Britain | |
// DD.MM.YYYY Germany | |
// DD-MM-YYYY Netherlands | |
// YYYY-MM-DD Canada | |
// YYYY/MM/DD South Africa | |
// YYYY.MM.DD Hungary | |
function getDateTimeFormats(/** @type {string | undefined} */ locale) { |
This file contains hidden or 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
javascript:void(prompt('Press%20Ctrl+C',decodeURIComponent(window.location.href).replace(/%20/g,'%2520'))) |
This file contains hidden or 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
namespace Razor.Mail | |
{ | |
public class RawString | |
{ | |
private readonly string _text; | |
public RawString(string text) => _text = text; | |
public override string ToString() | |
{ |
This file contains hidden or 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
const MixinHello = <T extends new (...args: any[]) => A>(base: T) => | |
class extends base { | |
hello() { } | |
}; | |
class A { | |
a() { } | |
} | |
class B extends A { |
This file contains hidden or 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 class AsyncHelper | |
{ | |
public static T RunSync<T>(Func<Task<T>> action) | |
{ | |
try | |
{ | |
var result = default(T); | |
Task.Run(async () => | |
{ | |
result = await action(); |
This file contains hidden or 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
DECLARE @Indexes table (TableName nvarchar(MAX), IndexName nvarchar(MAX), Value int) | |
INSERT INTO @Indexes | |
SELECT | |
QuoteName(s.name) + '.' + QuoteName(t.name) as TableName, | |
QuoteName(i.name) as IndexName, | |
avg_fragmentation_in_percent as Value | |
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL) AS ips | |
INNER JOIN sys.tables t on t.object_id = ips.object_id | |
INNER JOIN sys.schemas s on t.schema_id = s.schema_id | |
INNER JOIN sys.indexes AS i ON i.object_id = ips.object_id |
This file contains hidden or 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
select | |
count = count(*), | |
db_name = db_name(database_id), | |
status, | |
login_name, | |
host_name, | |
program_name | |
from sys.dm_exec_sessions | |
where is_user_process = 1 | |
group by database_id, status, login_name, host_name, program_name |