Skip to content

Instantly share code, notes, and snippets.

@jbogard
jbogard / Featurefolders.cs
Created October 3, 2013 15:55
Feature folders
public class FeatureViewLocationRazorViewEngine : RazorViewEngine
{
public FeatureViewLocationRazorViewEngine()
{
ViewLocationFormats = new[]
{
"~/Features/{1}/{0}.cshtml",
"~/Features/{1}/{0}.vbhtml",
"~/Features/Shared/{0}.cshtml",
"~/Features/Shared/{0}.vbhtml",
@plentz
plentz / nginx.conf
Last active June 2, 2024 15:03
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@tedmiston
tedmiston / nodejs-tcp-example.js
Last active May 20, 2024 11:27
Node.js TCP client and server example
/*
In the node.js intro tutorial (http://nodejs.org/), they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
*/
var net = require('net');
@DamianEdwards
DamianEdwards / Program.cs
Last active December 15, 2015 03:19
Demonstrates the behavior of SqlDataReader when inserts are happening during the Read() loop. Even with ReadUncommitted isolation for the consumer, the only records returned are those that existed when ExecuteReader() was called. UPDATE: Seems with big enough numbers the behavior can change, presumably due to how SQL decides to do locking (row, …
using System;
using System.Data;
using System.Data.SqlClient;
using System.Threading;
namespace DataReaderBehavior
{
class Program
{
private static readonly string _connectionString = @"Data Source=(local);Initial Catalog=master;Integrated Security=SSPI;";
@hanssens
hanssens / Pluralizer.cs
Created May 30, 2012 12:30
[C#] Pluralizer
/* **********************************************************************************
*
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* This source code is subject to terms and conditions of the Microsoft Permissive
* License (MS-PL). A copy of the license can be found in the license.htm file
* included in this distribution.
*
* You must not remove this notice, or any other, from this software.
*
@stuartf7
stuartf7 / qunit.teamcity.js
Created February 6, 2012 22:54
qUnit output for Teamcity
QUnit.moduleStart = function (name, testEnvironment) {
console.log("##teamcity[testSuiteStarted name='" + name + "']");
};
QUnit.moduleDone = function (name, failures, total) {
console.log("##teamcity[testSuiteFinished name='" + name + "']");
};
QUnit.testStart = function (name, testEnvironment) {
console.log("##teamcity[testStarted name='" + name + "']");
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}