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
| //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
| 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
| <%= 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
| # Script to download the latest NHprof build | |
| # Note that this script requires the 7zip command line (http://www.7-zip.org/) | |
| #configuration | |
| $installDir = "C:\Projects\tools\nhprof" | |
| $downloadDir = "C:\Temp\Nhprof" | |
| $7zipexe = "C:\Program Files\7-Zip\7z.exe" | |
| $url = "http://builds.hibernatingrhinos.com/downloadLatest/nhprof" | |
| $file = "$downloadDir\NHProf.zip" |
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
| //Query is marked as cacheable, but the query cache is never used. | |
| var rooms = session.CreateQuery("from Room order by Name") | |
| .SetCacheable(true) | |
| .List<Room>(); |
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
| $files = dir -recurse | where { $_.PSIsContainer -eq $false -and (get-content($_.FullName)).Length -gt 1000 } | |
| $count = $files.Count |
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 my %userprofile%/.gitconfig | |
| [alias] | |
| cia = !git add -A && git commit |
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
| <Database Name="Test" xmlns="http://schemas.microsoft.com/linqtosql/mapping/2007"> | |
| <Function Name="CustomersAndOrders" Method="CustomersAndOrders"> | |
| <ElementType Name="FluentLinqToSql.DatabaseTests.Entities.Customer" /> | |
| <ElementType Name="FluentLinqToSql.DatabaseTests.Entities.Order" /> | |
| </Function> | |
| </Database> |
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
| <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> | |
| <% int count = 0; %> | |
| <% for (int i = 0; i < ((ICollection)Model).Count; i++) { %> | |
| <input type="hidden" name="<%= ViewData.TemplateInfo.GetFullHtmlFieldName("") %>[<%= i %>]" /> | |
| <% } %> |