This file contains 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
// converts 0x00010203 to a byte array, containing: 0x03, 0x02, 0x01, 0x00 | |
public static byte[] ToBigEndian(int data) | |
{ | |
var result = new byte[4]; | |
result[0] = (byte)data; | |
result[1] = (byte)(((uint)data >> 8) & 0xFF); | |
result[2] = (byte)(((uint)data >> 16) & 0xFF); | |
result[3] = (byte)(((uint)data >> 24) & 0xFF); |
This file contains 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
protected override void ConfigureRequestContainer(TinyIoCContainer container, NancyContext context) | |
{ | |
var db = container.Resolve<ISisoDatabase>(); | |
container.Register<ISession>((c, overloads) => new SessionWrapper(db.BeginSession())); | |
} | |
public class SessionWrapper : ISession | |
{ | |
readonly ISession session; |
This file contains 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 IEnumerable<IComponentRegistration> GetComponentRegistrations(ITreeNode registrationRootElement) | |
{ | |
IStructuralMatchResult match = Match(registrationRootElement); | |
if (match.Matched) | |
{ | |
// ReSharper SSR will match a generic method with this pattern too. If has generic arguments, return | |
var invocationExpression = match.MatchedElement as IInvocationExpression; | |
if (invocationExpression == null || invocationExpression.TypeArguments.Count > 0) | |
{ |
This file contains 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
// #1 | |
public IModule GetTargetModule(ICSharpExpression expression) | |
{ | |
var referenceExpression = expression as IReferenceExpression; | |
if (referenceExpression != null) | |
{ | |
var typeofExpression = referenceExpression.QualifierExpression as ITypeofExpression; | |
if (typeofExpression != null) | |
{ |
This file contains 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
let unionCases<'a> = | |
FSharpType.GetUnionCases(typeof<'a>) | |
|> Array.map (fun x -> FSharpValue.MakeUnion(x, [||]) :?> 'a) | |
|> Array.toList | |
let deck : Deck = | |
(unionCases<Suit>, unionCases<Rank>) ||> cartesianProduct |
This file contains 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
Here's how you can find all instances of System.Uri's ToString() method with ReSharper SSR (Structural Search and Replace): | |
1. Go to ReSharper menu -> Find -> Search with Pattern | |
2. Type in the following in the search pattern window: | |
$uri$.ToString() | |
3. Click 'Add Placeholder', select Expression. In the new dialog, put uri in the Name and 'System.Uri' in Expression type . | |
4. Click Find! | |
5. Voilla! |
This file contains 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 AnonymousCheckoutController : StoreController | |
{ | |
public AnonymousCheckoutController( | |
Services.ISalesService salesService | |
, Services.ICartService cartService | |
, Services.IAccountService accountService | |
, Services.IEmailerService emailerService | |
, Services.IDocumentService documentService | |
, Services.ICacheService cacheService | |
, Services.IAddressService addressService |
This file contains 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
Buildfile: file:///D:/code/Tao/Tao.build | |
Target framework: Microsoft .NET Framework 3.5 | |
Target(s) specified: test | |
compile-interfaces: | |
[csc] Compiling 4 files to 'D:\code\Tao\build\net-2.0\Tao.Interfaces.dll'. | |
[csc] d:\code\Tao\src\Tao.Interfaces\IFunction.cs(8,32): error CS1031: Type expected | |
[csc] d:\code\Tao\src\Tao.Interfaces\IFunction.cs(8,32): error CS1519: Invalid token 'in' in class, struct, or int |
This file contains 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
// based on an old blog post in Japanese: http://blog.sharplab.net/computer/cprograming/windowslivewriter/433/ | |
// The field was moved to a base type in the latest version of Live Writer | |
using System.Reflection; | |
using WindowsLive.Writer.Api; | |
using WindowsLive.Writer.Extensibility.BlogClient; | |
using WindowsLive.Writer.PostEditor; | |
namespace WindowsLiveWriterPlugin.Extensions | |
{ |
This file contains 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
CitizenMatt PreviewTab build 1.2.0 on 2015-08-07 09:38:44Z. | |
ConfigureAwaitChecker v9 build 0.4.0.1 on 2015-08-07 09:38:44Z. | |
EtherealCode ReSpeller build 4.1.9.0 on 2015-08-07 09:38:44Z. | |
EtherealCode ReSpellerPro build 4.1.9.0 on 2015-08-07 09:38:44Z. | |
JetBrains Mnemonics build 1.1.1 on 2015-08-07 09:38:44Z. | |
JLebosquain EnhancedTooltip build 2.3.1 on 2015-08-07 09:38:44Z. | |
JoarOyen ReSharper.LiveTemplates build 2.0.1.0 on 2015-08-07 09:38:44Z. | |
ReSharper AgentMulder build 1.2.0 on 2015-08-07 09:38:44Z. | |
ReSharper HeapView.R90 build 0.9.7 on 2015-08-07 09:38:44Z. | |
ReSharper Postfix.R90 build 2.1.1 on 2015-08-07 09:38:44Z. |