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
class Program | |
{ | |
private const string Cyrillic = "Cyrillic"; | |
private const string Nullable = "?"; | |
static void Main() | |
{ | |
string schemaText; | |
using (var r = new StreamReader("schema.txt")) |
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
function Stopwatch() | |
{ | |
var sw = this; | |
var start = null; | |
var stop = null; | |
var isRunning = false; | |
sw.__defineGetter__("ElapsedMilliseconds", function() | |
{ | |
return (isRunning ? new Date() : stop) - start; |
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
[DataContract] | |
public class MyNameValueInfoSurrogate | |
{ | |
//string is serializable so we'll just copy this property back and forth | |
[DataMember(Order = 1)] | |
public string Name { get; set; } | |
//byte[] is serializable so we'll need to convert object to byte[] and back again | |
[DataMember(Order = 2)] | |
public byte[] Value { get; set; } |
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.Drawing; | |
using Console = Colorful.Console; | |
namespace lolcmd | |
{ | |
class Program | |
{ | |
private static Random random = new Random(); |
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.Security.Cryptography; | |
using System.Text; | |
public static class Crypto | |
{ | |
#region MD5 | |
public static string HashMD5(string phrase) | |
{ |
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.ServiceModel; | |
public class ServiceHelper | |
{ | |
#region Public Methods | |
/// <summary> | |
/// WCF proxys do not clean up properly if they throw an exception. This method ensures that the service proxy is handled correctly. | |
/// Do not call TService.Close() or TService.Abort() within the action lambda. |
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
/*-------------------------------------------------------------------------- | |
* linq.js - LINQ for JavaScript | |
* ver 2.2.0.2 (Jan. 21th, 2011) | |
* | |
* created and maintained by neuecc <ils@neue.cc> | |
* licensed under Microsoft Public License(Ms-PL) | |
* http://neue.cc/ | |
* http://linqjs.codeplex.com/ | |
*--------------------------------------------------------------------------*/ |
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 bootstrapCss = 'bootstrapCss'; | |
if (!document.getElementById(bootstrapCss)) | |
{ | |
var head = document.getElementsByTagName('head')[0]; | |
var bootstrapWrapper = document.createElement('link'); | |
bootstrapWrapper.id = bootstrapCss; | |
bootstrapWrapper.rel = 'stylesheet/less'; | |
bootstrapWrapper.type = 'text/css'; | |
bootstrapWrapper.href = '../wp-content/plugins/myplugin/css/bootstrap-wrapper.less'; | |
bootstrapWrapper.media = 'all'; |
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
class KeyLockerExample | |
{ | |
static readonly ThreadState[] StopStates = { ThreadState.AbortRequested, ThreadState.Aborted }; | |
static void Main() | |
{ | |
var threads = new List<Thread>(); | |
var sw = new Stopwatch(); | |
var timelimit = new TimeSpan(0, 0, 30); |
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 class KeyLocker : IDisposable | |
{ | |
private static readonly ConcurrentDictionary<object, object> Locks = new ConcurrentDictionary<object, object>(); | |
private readonly object _locker; | |
public KeyLocker(object key) | |
{ | |
_locker = Locks.GetOrAdd(key, new object()); | |
Monitor.Enter(_locker); | |
} |
NewerOlder