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.IO; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace StreamReadWrite | |
{ | |
class Program |
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 HomeController : Controller { | |
public async Task<ActionResult> Index() { | |
return await Task.FromResult<ActionResult>(View()); | |
} | |
} |
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.Diagnostics; | |
using System.Linq; | |
using System.Reflection; | |
namespace CheckIfDebugOrRelease | |
{ | |
class Program | |
{ |
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
private static readonly SemaphoreSlim __questionCloseLock = new SemaphoreSlim(initialCount: 1); | |
public async Task<OperationResult<QuestionCloseRecord>> CloseQuestionAsync(int questionId, QuestionCloseType closeType) | |
{ | |
try | |
{ | |
await __questionCloseLock.WaitAsync().ConfigureAwait(false); | |
Question question = await GetQuestionAsync(questionId).ConfigureAwait(false); | |
if (question == null || question.CloseRecord != 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
using System; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using System.Web.Http; | |
namespace WebApiInMemoryHost | |
{ | |
class Program | |
{ | |
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
internal sealed class Configuration : DbMigrationsConfiguration<SpatialDemo.Models.SpatialDemoContext> | |
{ | |
public Configuration() | |
{ | |
AutomaticMigrationsEnabled = true; | |
} | |
protected override void Seed(SpatialDemo.Models.SpatialDemoContext context) | |
{ | |
context.Locations.AddOrUpdate((x) => x.Name, |
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
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Profile("i++", () => | |
{ | |
for (int i = 0; i < int.MaxValue; i++) | |
{ | |
double foo = Math.Round(Math.Sqrt(3.4F) * 7823278.9F, 2); | |
} |
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
Set-ExecutionPolicy RemoteSigned | |
$mongoDbPath = "C:\MongoDB" | |
$mongoDbConfigPath = "$mongoDbPath\mongod.cfg" | |
$url = "http://downloads.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.2.3.zip" | |
$zipFile = "$mongoDbPath\mongo.zip" | |
$unzippedFolderContent ="$mongoDbPath\mongodb-win32-x86_64-2008plus-2.2.3" | |
if ((Test-Path -path $mongoDbPath) -eq $True) | |
{ |
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
// These are jQuery fns. | |
(function ($) { | |
$.fn.removeMVCValidationSummary = function (settings) { | |
var form = $(this), | |
container = form.find("[data-valmsg-summary=true]"), | |
list = container.find("ul"); | |
container.removeClass("validation-summary-errors").addClass("validation-summary-valid"); |
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
class Program { | |
static void Main(string[] args) { | |
var type = typeof(Foo); | |
var isIFoo = typeof(IFoo).IsAssignableFrom(type); | |
} | |
} | |
public interface IFoo { |