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 IsVowel(letter) | |
| { | |
| return ['a','e','i','o','u'].some(function(vowel){ | |
| return vowel == letter; | |
| }); | |
| } | |
| function PigLatin(word) | |
| { | |
| if(IsVowel(word[0])) { |
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 PostSharp.Constraints; | |
| using PostSharp.Extensibility; | |
| namespace PostsharpArchitecturalConstraints.Constraints | |
| { | |
| [Serializable] | |
| [MulticastAttributeUsage(MulticastTargets.Class)] | |
| public class NHEntityAttribute : MulticastAttribute, IScalarConstraint | |
| { |
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
| // this is in one assembly | |
| using PostSharp.Constraints; | |
| namespace PostsharpArchitecturalConstraints.API.Implementation | |
| { | |
| [Internal] | |
| public class PublicAndInternal | |
| { | |
| public string GetValue() |
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
| // ApiA.cs | |
| using PostSharp.Constraints; | |
| namespace PostsharpArchitecturalConstraints.API.NamespaceA | |
| { | |
| [Friend] | |
| internal class ApiA | |
| { | |
| public string GetFriendsName() | |
| { |
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
| // use the service locator | |
| ServiceLocator.Context = ((Context)this).ApplicationContext.ApplicationContext; // you only need to do this once in the lifetime of your Android app | |
| _presenter = ServiceLocator.Get(typeof(IMainPresenter)); | |
| // or a plain old 'new' | |
| _presenter = new MainPresenter(new AndroidSqlitePortfolioRepository((Context)this)) |
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 Moq; | |
| using Ninject; | |
| using NUnit.Framework; | |
| using PostSharp.Aspects; | |
| namespace mockobjectsinaspect | |
| { | |
| [SomeAspect] | |
| public class MyWcfClass |
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
| // latestcommentswidgetdriver.cs | |
| using LatestComments.Models; | |
| using Orchard.ContentManagement; | |
| using Orchard.ContentManagement.Drivers; | |
| namespace LatestComments.Drivers | |
| { | |
| public class LatestCommentsWidgetDriver : ContentPartDriver<LatestCommentsWidgetPart> | |
| { | |
| // GET |
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
| ObjectFactory.Initialize(x => | |
| { | |
| x.Scan(scan => | |
| { | |
| scan.TheCallingAssembly(); | |
| scan.WithDefaultConventions(); | |
| }); | |
| x.For<IDbConnection>().HttpContextScoped().Use(c => GetSqlConnection()); | |
| }); |
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
| ObjectFactory.Initialize(x => | |
| { | |
| x.Scan(scan => | |
| { | |
| scan.TheCallingAssembly(); | |
| scan.WithDefaultConventions(); | |
| }); | |
| x.For<IDbConnection>().Use(c => GetSqlConnection()); | |
| }); |
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 Castle.DynamicProxy; | |
| namespace DynamicProxyExample1 | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| var generator = new ProxyGenerator(); |