Skip to content

Instantly share code, notes, and snippets.

internal class Program
{
private const int size = 500;
private const int iterations = 5000;
private static void Main( string[] args )
{
TimeSpan elapsed = TimeOriginal();
Console.WriteLine( elapsed );
#region License
//
// Author: Nate Kohari <[email protected]>
// Copyright (c) 2007-2010, Enkari, Ltd.
//
// Dual-licensed under the Apache License, Version 2.0, and the Microsoft Public License (Ms-PL).
// See the file LICENSE.txt for details.
//
#endregion
#if !NO_ASSEMBLY_SCANNING
src/Ninject/Activation/Blocks/ActivationBlock.cs | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Ninject/Activation/Blocks/ActivationBlock.cs b/src/Ninject/Activation/Blocks/ActivationBlock.cs
index b16b503..4b64376 100644
--- a/src/Ninject/Activation/Blocks/ActivationBlock.cs
+++ b/src/Ninject/Activation/Blocks/ActivationBlock.cs
@@ -68,10 +68,10 @@ namespace Ninject.Activation.Blocks
/// </summary>
/// <param name="request">The request.</param>
#region Using Directives
using System;
using System.ServiceProcess;
using YourCorp.Services;
using Ninject;
using Topshelf;
using Topshelf.Configuration;
using Topshelf.Configuration.Dsl;
if (bindings == null)
{
return false;
}
lock(_handleMissingBindingLockObject)
{
if (!CanResolve(request))
{
bindings.Map(binding => binding.IsImplicit = true);
public enum TestEnum
{
None =0,
One = 1,
Two = 2
}
var zero = Enum<TestEnum>.GetValue<int>( TestEnum.None );
var one = Enum<TestEnum>.GetValue<int>( TestEnum.One );
var two = Enum<TestEnum>.GetValue<int>( TestEnum.Two );
var nine = Enum<TestEnum>.GetValue<int>( TestEnum.One | TestEnum.Eight );
@idavis
idavis / Use-Impersonation.ps1
Created March 5, 2011 18:52
Impersonate a user and execute a script block as that user
param( [ScriptBlock] $scriptBlock )
<#
.SYNOPSIS
Impersonates a user and executes a script block as that user. This is an interactive script
and a window will open in order to securely capture credentials.
.EXAMPLE
Use-Impersonation.ps1 {Get-ChildItem 'C:\' | Foreach { Write-Host $_.Name }}
This writes the contents of 'C:\' impersonating the user that is entered.
#>
;config.ini
[Network]
DataFeed=http://mydomain.com/feed.xml
Port=68
NextUpdate=3/23/2009 9:11:48 PM
You can load it:
var configurationSource = new IniConfigurationSource("config.ini");
var datafeed = configurationSource.Sections["Network"].Get<string>("DataFeed");
@idavis
idavis / SecurityTest.txt
Created May 16, 2011 20:50
Executing scripts while script execution is disabled
PS C:\Development\PowerStudio> set-executionpolicy default
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution
policy might expose you to the security risks described in the about_Execution_Policies help topic.
Do you want to change the execution policy?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y
PS C:\Development\PowerStudio> type .\test.ps1
gci
PS C:\Development\PowerStudio> .\test.ps1
@idavis
idavis / Models.cs
Created July 6, 2011 22:33
Inverse null coalescing 'operator' support. Only properties are allowed.
#region Using Directives
using System.Threading;
#endregion
namespace ObjectExtensions.Tests
{
public class Person
{