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.Collections.Generic; | |
using System.Threading.Tasks; | |
using System.Collections.Concurrent; | |
using System.Text; | |
using System.Threading; | |
namespace MapReduceWords | |
{ | |
public class WordReducer |
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
START /WAIT DISM /Online /Enable-Feature /FeatureName:IIS-ApplicationDevelopment /FeatureName:IIS-ASP /FeatureName:IIS-ASPNET /FeatureName:IIS-BasicAuthentication /FeatureName:IIS-CGI /FeatureName:IIS-ClientCertificateMappingAuthentication /FeatureName:IIS-CommonHttpFeatures /FeatureName:IIS-CustomLogging /FeatureName:IIS-DefaultDocument /FeatureName:IIS-DigestAuthentication /FeatureName:IIS-DirectoryBrowsing /FeatureName:IIS-FTPExtensibility /FeatureName:IIS-FTPServer /FeatureName:IIS-FTPSvc /FeatureName:IIS-HealthAndDiagnostics /FeatureName:IIS-HostableWebCore /FeatureName:IIS-HttpCompressionDynamic /FeatureName:IIS-HttpCompressionStatic /FeatureName:IIS-HttpErrors /FeatureName:IIS-HttpLogging /FeatureName:IIS-HttpRedirect /FeatureName:IIS-HttpTracing /FeatureName:IIS-IIS6ManagementCompatibility /FeatureName:IIS-IISCertificateMappingAuthentication /FeatureName:IIS-IPSecurity /FeatureName:IIS-ISAPIExtensions /FeatureName:IIS-ISAPIFilter /FeatureName:IIS-LegacyScripts /FeatureName:IIS-LegacySnapIn /FeatureNam |
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; | |
namespace Curry | |
{ | |
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ |
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 override int SaveChanges() | |
{ | |
using (var scope = new TransactionScope()) | |
{ | |
var addedEntries = ChangeTracker.Entries().Where(e => e.State == EntityState.Added).ToList(); | |
var modifiedEntries = ChangeTracker.Entries().Where(e => e.State == EntityState.Deleted || e.State == EntityState.Modified).ToList(); | |
foreach (var entry in modifiedEntries) | |
{ | |
ApplyAuditLog(entry); |
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
Type type = typeof (Bootstrap<>); | |
Type genericType = type.MakeGenericType(new Type[] {typeof (TModel)}); | |
const BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Instance; | |
object instantiatedType = Activator.CreateInstance(genericType, flags, null, new HtmlHelper<TModel>[] { helper }, null); | |
return (Bootstrap<TModel>)instantiatedType; |
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
// Linear Congruential Generator | |
// Variant of a Lehman Generator | |
var lcg = (function() { | |
// Set to values from http://en.wikipedia.org/wiki/Numerical_Recipes | |
// m is basically chosen to be large (as it is the max period) | |
// and for its relationships to a and c | |
var m = 4294967296, | |
// a - 1 should be divisible by m's prime factors | |
a = 1664525, | |
// c and m should be co-prime |
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() { | |
var addMessage, connection, content, input, myName, status; | |
content = $("#content"); | |
input = $("#input"); | |
status = $("#status"); | |
myName = false; | |
connection = new WebSocket("ws://127.0.0.1:1337"); | |
connection.onopen = function() { |
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 EnumExtensions | |
{ | |
/// <summary> | |
/// Gets all items for an enum value. | |
/// </summary> | |
/// <typeparam name="T"></typeparam> | |
/// <param name="value">The value.</param> | |
/// <returns></returns> | |
public static IEnumerable<T> GetAllItems<T>(this Enum value) | |
{ |
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
[SuppressUnmanagedCodeSecurity] | |
internal static class SafeNativeMethods | |
{ | |
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode)] | |
public static extern int StrCmpLogicalW(string psz1, string psz2); | |
} | |
public sealed class NaturalStringComparer : IComparer<string> | |
{ | |
public int Compare(string a, string b) |
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
if (oDs.Tables.Count > 1) | |
{ | |
oDs.Tables[1].Rows.Cast<DataRow>() | |
.Where(r => | |
r["first"].ToString() == "0" || | |
r["second"].ToString() == "5" || | |
r["third"].ToString() == "000") | |
.ToList() | |
.ForEach(row => | |
{ |