Skip to content

Instantly share code, notes, and snippets.

View mxriverlynn's full-sized avatar
🏳️‍🌈
coding while trans

River Lynn Bailey mxriverlynn

🏳️‍🌈
coding while trans
View GitHub Profile
Component(d => d.Detail, m =>
{
m.Access.AsCamelCaseField(Prefix.Underscore);
m.Map(d => d.Destination);
m.Component(o => o.Override, overrideMap =>
{
overrideMap.Map(o => o.OverridenBy).Access.AsProperty();
overrideMap.Map(o => o.DateOfOverride).Access.AsProperty();
}).Access.AsProperty();
});
FluentConfiguration fluentConfig = Fluently.Configure()
.Database(SQLiteConfiguration.Standard.ConnectionString(c => c.Is("conn string")))
.Mappings(m => m.FluentMappings
.ConventionDiscovery.Add(DefaultLazy.AlwaysFalse())
.AddFromAssemblyOf<UserMap>()
);
Configuration configuration = fluentConfig.BuildConfiguration();
return configuration;
def build_options(option_name, option_values={})
if (option_values.length > 0)
option_text = "/#{option_name}:"
if (option_values.kind_of?(Hash))
option_text << process_hash(option_values)
else
option_text << process_array(option_values)
end
option_text = option_text.chop
end
def build_hash_options(option_name, option_values={})
return if (option_values.length==0)
option_text = "/#{option_name}:"
option_values.each do |key, value|
option_text << "#{key}\=#{value};"
end
option_text = option_text.chop
option_text
class Hash
def build_parameters
option_text = ''
self.each do |key, value|
option_text << "#{key}\=#{value};"
end
option_text.chop
end
end
#........... in my 'patches' folder
module HashParameterBuilder
def build_parameters
option_text = ''
self.each do |key, value|
option_text << "#{key}\=#{value};"
end
option_text.chop
end
desc "Run a sample build using the MSBuildTask"
Rake::MSBuildTask.new(:msbuild) do |msb|
# ... other stuff set, here
#if you want extended debugging info, set the log_level to :verbose
#defaults to not being verbose mode and only basic messages are shown
msb.log_level = :verbose
#if you want to set a specific IO device for the log messages, set here
#defaults to STDIO
@mxriverlynn
mxriverlynn / a simple method stubbing example.rb
Created October 22, 2009 01:10
a quick and dirty example of how to stub a method on an object
require 'singleton'
class BlockTest
def test
puts "this is the real method."
yield if block_given?
end
end
class Object
@mxriverlynn
mxriverlynn / rakefile.rb
Created November 8, 2009 02:38
an example of expanding templates for deployment, with Albacore
require 'albacore'
Albacore::ExpandTemplatesTask.new(:templates) do |templates|
templates.expand_files = {"./templates/web.config.template" => "./www/web.config"}
templates.data_file = "./templates/data/web.config.yml"
end
public class AppController: IApplicationController
{
//other app controller stuff here
public R Query<T,R>(T queryData)
{
R returnValue = default(R);
IQuery<T,R> query = iocContainer.GetInstance<IQuery<T,R>>();
if (query != null)
returnValue = query.Query(T);