Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Generic;
using System.Linq;
using AutoMapper;
namespace DovetailCRM.Core.Web.Mapping
{
public static class AutoMapperExtensions
{
public static void CreateMapsForSourceTypes(this IConfiguration configuration, Func<Type, bool> filter, Func<Type, Type> destinationType, Action<IMappingExpression, Type, Type> mappingConfiguration)
menuLine.bind("click",function(){
if (($(voice).attr("action") || $(voice).attr("href")) && !isDisabled){
var target=$(voice).attr("target")?$(voice).attr("target"):"_self";
if ($(voice).attr("href") && $(voice).attr("href").indexOf("javascript:")>-1){
$(voice).attr("action",$(voice).attr("href").replace("javascript:",""));
}
var link=$(voice).attr("action")?$(voice).attr("action"):"window.open('"+$(voice).attr("href")+"', '"+target+"')";
if (!$(voice).attr("href") || ($(voice).attr("href") && $(voice).attr("href").indexOf("javascript:")>-1)){
$(voice).removeAttr("href");
}
public class CustomViewVirtualPathProvider : VirtualPathProvider
{
public override bool FileExists(string virtualPath)
{
return File.Exists(HostingEnvironment.MapPath(virtualPath));
}
public override VirtualFile GetFile(string virtualPath)
{
var customizedVirtualPath = virtualPath.Replace(HostingEnvironment.ApplicationVirtualPath, HostingEnvironment.ApplicationVirtualPath + "/CustomViews/");
desc "Generate the database schema"
task :db do
$:.unshift('.\src\MyApp\bin') # Add the website bin folder to the load_path so that assembly dependencies are found
require 'MyApp' # MyApp is my ASP.NET web app assembly DLL
MyApp::Database.BuildSchema # Database.BuildSchema is a static method
puts 'Database rebuilt'
end
##### Using ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
C:\code>irb
irb(main):001:0> include FileTest
=> Object
irb(main):002:0> exists? 'foo'
=> false
irb(main):003:0>
### Using IronRuby 1.0
C:\code>ir
using System;
using StructureMap;
namespace ConsoleApplication1
{
class Program {
private static void Main(string[] args) {
IContainer container = ConfigureDependencies();
IAppEngine appEngine = container.GetInstance<IAppEngine>();
public static HtmlTag TableFor<T>(this IFubuPage view, IEnumerable<T> data, params string[] columns) where T : class
{
var properties = typeof(T).GetProperties();
// optionally limit the columns to display
if (columns.Length > 0) properties = properties.Where(p => columns.Contains(p.Name)).ToArray();
var table = new HtmlTag("table");
var header = new HtmlTag("thead");
table.Child(header);
foreach (var property in properties)
@joshuaflanagan
joshuaflanagan / restoredb.sql
Created July 14, 2010 16:45
Restore a SQL Server database
ALTER DATABASE mydbname SET SINGLE_USER With ROLLBACK IMMEDIATE
RESTORE DATABASE mydbname FROM DISK = 'c:\path\to\file.bak' WITH REPLACE
<!-- the expression in the container is used by the contained LableFor and InputFor -->
<div for="x => x.FirstName">
<div class="shiny">{ Label }</div>
<div class="happy">{ Input }</div>
</div>
<!-- or if you don't need a container, use a "virtual", non-printing tag
<surround for="x => x.FirstName">
<dt class="shiny">{ Label }</dt>
class Hash
def deep(*path)
path.inject(self) {|h,k| h.respond_to?(:fetch) ? h.fetch(k, nil) : h}
end
end
#example
stuff = {
:foo => {
:bar => nil