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; | |
namespace Microsoft.Practices.Unity | |
{ | |
public static class IUnityContainerExtensions | |
{ | |
/// <summary> | |
/// Registers a ContentControl for navigation using the name parameter. | |
/// </summary> | |
/// <typeparam name="T">The type of ContentControl to register</typeparam> |
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.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.Practices.Prism.Logging; | |
namespace Microsoft.Practices.Prism.Logging | |
{ | |
public static class ILoggerFacadeExtensions |
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
/// <summary> | |
/// Implements <see cref="INotifyPropertyChanged"/> and <see cref="MarshalByRefObject"/> for interception in view models. | |
/// </summary> | |
public abstract class InterceptableViewModelBase : MarshalByRefObject, INotifyPropertyChanged | |
{ | |
/// <summary> | |
/// Occurs when a property value changes. | |
/// </summary> | |
public event PropertyChangedEventHandler PropertyChanged; | |
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.Net; | |
using System.Threading; | |
namespace System.Net.Sockets | |
{ | |
public class Client | |
{ | |
// Fields... | |
private Socket clientSocket = null; |
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
/* | |
Sample of use: | |
<ComboBox ItemsSource="{Binding Source={ Extensions:ByteEnumerationExtention {x:Type type:MyEnum} }}" DisplayMemberPath="Description" | |
SelectedValuePath="Value" SelectedValue="{Binding SelectedItemInViewModel}"/> | |
public enum MyEnum : short | |
{ | |
[Description("گزینه 1")] | |
Item1 = 1, | |
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 class Foo | |
{ | |
public void Method1() | |
{ | |
Console.WriteLine("Method1: this == null: {0}", this == null); | |
} | |
} | |
var m1 = typeof(Foo).GetMethod("Method1"); | |
var method1 = Delegate.CreateDelegate(typeof(Action<Foo>), m1) as Action<Foo>; |
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
# Batch script to generate Open SSL self signed certificate | |
openssl req -new -x509 -nodes -newkey rsa:1024 -keyout webhook_pkey.key -out webhook_cert.pem -days 3650 | |
openssl pkcs12 -export -out newfile.pfx -inkey privcert.key -in pubcert.pem -certfile CARoots.pem |
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
--get most used tables | |
SELECT | |
db_name(ius.database_id) AS DatabaseName, | |
t.NAME AS TableName, | |
SUM(ius.user_seeks + ius.user_scans + ius.user_lookups) AS NbrTimesAccessed | |
FROM sys.dm_db_index_usage_stats ius | |
INNER JOIN sys.tables t ON t.OBJECT_ID = ius.object_id | |
WHERE database_id = DB_ID('MyDb') | |
GROUP BY database_id, t.name | |
ORDER BY SUM(ius.user_seeks + ius.user_scans + ius.user_lookups) DESC |
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
function TimeSpan(seed) { | |
//"00:00:00" | |
var self = this; | |
self.hour = seed.substr(0, 2); | |
self.minute = seed.substr(3, 2); | |
self.second = seed.substr(6, 2); | |
self.addSecond = function () { | |
self.second++; | |
if (self.second >= 60) { |
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 class BotUserAgentUtility | |
{ | |
public static bool IsBot(string userAgent) | |
{ | |
var Crawlers = new List<string>() | |
{ | |
"googlebot","bingbot","yandexbot","ahrefsbot","msnbot","linkedinbot","exabot","compspybot", | |
"yesupbot","paperlibot","tweetmemebot","semrushbot","gigabot","voilabot","adsbot-google", | |
"botlink","alkalinebot","araybot","undrip bot","borg-bot","boxseabot","yodaobot","admedia bot", | |
"ezooms.bot","confuzzledbot","coolbot","internet cruiser robot","yolinkbot","diibot","musobot", |