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
| <%= Html.ScriptInclude("foo") %> | |
| <% if(false) { %> | |
| <script type="text/javascript" src="/path/to/foo.js"></script> | |
| <% } %> |
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 Customer { | |
| public int Id { get; set; } //assumes public property named "Id" is PK | |
| public string Name { get; set; } //all public read/write properties auto-mapped to db cols | |
| } | |
| //config: | |
| ActiveRecordConfiguration.Configure(cfg => { | |
| cfg.ConnectToSqlServer("(local)", "mydb", "user", "pass"); | |
| cfg.MapTypesFromAssemblyContaining<Customer>(); | |
| //lots of other options... |
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 autofac | |
| [Test] | |
| public void Creates_dependencies() { | |
| var builder = new ContainerBuilder(); | |
| builder.RegisterModule(new AppModule()); | |
| var container = builder.Build(); | |
| var types = from type in typeof(HomeController).Assembly.GetExportedTypes() | |
| where typeof(Controller).IsAssignableFrom(type) && !type.IsAbstract | |
| select type; |
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
| //Yuck... | |
| IEnumerable<Func<object, object>> funcs = GetFuncs(); | |
| var convertedFuncs = funcs.Select(func => new Func<T, object>(x => func(x))).ToList(); |
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
| Clone as normal... | |
| git clone git://...url... | |
| Create and check out a local branch that tracks the remote branch | |
| git checkout -b <branch name> --track origin/<remote branch name> | |
| Pull changes into the branch: | |
| git pull origin <remote name> |
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
| var cfg = Fluently.Configure() | |
| .Database(MsSqlConfiguration.MsSql2005 | |
| .ProxyFactoryFactory(typeof(ProxyFactoryFactory).AssemblyQualifiedName) | |
| .ConnectionString(conn => conn.FromConnectionStringWithKey("Web")) | |
| ).BuildConfiguration(); |
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
| with FileList(): | |
| .Include("src/Phantom/bin/${configuration}/*.{dll,exe}") | |
| .Include("License.html") | |
| .ForEach def(file): | |
| file.CopyToDir("build/${configuration}") |
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
| target copyFiles: | |
| FileList.Create def(fl): | |
| fl.Include("src/Phantom/bin/${configuration}/*.{dll,exe}") | |
| fl.Include("License.html") | |
| fl.ForEach def(file): | |
| file.CopyTo("build") |
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
| var handlerInterface = typeof(MyHandler).GetInterfaces()[0]; //This implements IHandle<T> (eg IHandle<Foo>) | |
| var commandType = handlerInterface.GetGenericArguments()[0]; //this is the type being handled, eg Foo | |
| var maker = GetType().GetMethod("ResolveHandler", BindingFlags.Static | BindingFlags.Public | BindingFlags.Instance); | |
| var compiledDelegate = (Func<object>)Delegate.CreateDelegate(typeof(Func<object>), maker); |
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
| <script type="text/javascript"> | |
| var person = { Name: "Jeremy", Id: 1 }; | |
| </script> | |
| <input type="text" sys:value="{binding path=Name, source={{person}} }" /> |