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.Threading.Tasks; | |
namespace System.Collections.Concurrent | |
{ | |
public static class ConcurrentDictionaryExtensions | |
{ | |
/// <summary> | |
/// Provides an alternative to <see cref="ConcurrentDictionary{TKey, TValue}.GetOrAdd(TKey, Func{TKey, TValue})"/> that disposes values that implement <see cref="IDisposable"/>. | |
/// </summary> |
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
<Project> | |
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" /> | |
<PropertyGroup> | |
<TargetFramework>netstandard1.0</TargetFramework> | |
<IsPackable>true</IsPackable> | |
<IncludeBuildOutput>false</IncludeBuildOutput> | |
<ContentTargetFolders>contentFiles</ContentTargetFolders> | |
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences> |
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 BetterDefaultModelBinder : DefaultModelBinder | |
{ | |
protected override object CreateModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Type modelType) | |
{ | |
var model = base.CreateModel(controllerContext, bindingContext, modelType); | |
if (model == null || model is IEnumerable) | |
return model; | |
foreach (var property in modelType.GetProperties(BindingFlags.Public | BindingFlags.Instance)) |
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 class ShutdownDetector : IRegisteredObject, IDisposable | |
{ | |
private readonly CancellationTokenSource _cts = new CancellationTokenSource(); | |
private Timer _checkAppPoolTimer; | |
private static readonly TimeSpan _appPoolCheckInterval = TimeSpan.FromSeconds(10); | |
public CancellationToken Token | |
{ | |
get { return _cts.Token; } | |
} |
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
.ui-autocomplete { | |
position: absolute; | |
cursor: default; | |
list-style: none; | |
display: block; | |
outline: none; | |
padding: 5px 0; | |
margin: 2px 0 0; | |
background-color: @dropdownBackground; | |
border: 1px solid #ccc; // Fallback for IE7-8 |
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
#git is aliased as 'g' | |
#g co == git checkout | |
#g c = git commit -m | |
#g rom = git rebase origin/master | |
g clone <your repo> | |
g co -b feature-branch | |
#work | |
#work |
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; | |
using System.Linq.Expressions; | |
using Raven.Abstractions.Data; | |
namespace Raven.Client | |
{ | |
public static class StronglyTypedDocumentQueryExtensions | |
{ |
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 where-is($command) { | |
(ls env:\path).Value.split(';') | ` | |
where { $_ } | ` | |
%{ [System.Environment]::ExpandEnvironmentVariables($_) } | ` | |
where { test-path $_ } |` | |
%{ ls "$_\*" -include *.bat,*.exe,*cmd } | ` | |
%{ $file = $_.Name; ` | |
if($file -and ($file -eq $command -or ` | |
$file -eq ($command + '.exe') -or ` | |
$file -eq ($command + '.bat') -or ` |
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
cd %windir%\Microsoft.NET\Framework\v4.0.30319 | |
ngen uninstall "%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.Blend.dll" | |
ngen uninstall "%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.Code.dll" | |
ngen uninstall "%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.DesignModel.dll" | |
ngen uninstall "%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.DesignSurface.dll" | |
ngen uninstall "%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.Extensibility.Designer.dll" | |
ngen uninstall "%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.Extensibility.dll" | |
ngen uninstall "%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.Extensibility.Project.dll" | |
ngen uninstall "%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.Framework.dll" | |
ngen uninstall "%ProgramFiles(x86)%\Microsoft Expression\Blend 4\Microsoft.Expression.Importers.dll" |
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.ComponentModel; | |
using System.Globalization; | |
using System.Windows; | |
using System.Windows.Controls; | |
using System.Windows.Data; | |
using System.Windows.Markup; | |
using System.Xaml; | |
namespace YourNamespace.MarkupExtensions |
NewerOlder