Skip to content

Instantly share code, notes, and snippets.

View pwelter34's full-sized avatar

Paul Welter pwelter34

View GitHub Profile
@pwelter34
pwelter34 / Bootstrap.cs
Created May 27, 2014 18:32
Bootstrap fluent interface
Bootstrap
.Assemblies(scan => {
scan.Include().FromType<Type>();
scan.Include().Assembly(Assembly);
scan.Include().StartsWith(string);
scan.Include().Contains(string);
scan.Include().LoadedAssemblies();
scan.Include().ReferencedAssemblies();
Kick.Start(config => {
config
.IncludeLoadedAssemblies()
.IncludeReferencedAssemblies()
.IncludeAssemblyFor<Type>()
.IncludeAssembly(Assembly)
.IncludeName(string)
.ExcludeAssemblyFor<Type>()
@pwelter34
pwelter34 / default.ps1
Created July 25, 2014 15:56
psake robocopy
Task Output -Depends Compile {
“Copy Outputs...”
$xf = @("*.log", "*.txt", "*.md", "*.xml", "*.pdb")
$xd = @(".git", "obj")
& robocopy "$SourceDir\bin\$BuildConfig" "$BuildDir\Output" $np /XF $xf /XD $xd /NP
if ($lastexitcode -ge 8) {
throw ("RoboCopy: Error copying files.")
@echo off
for /F "tokens=1* delims= " %%A in ('date /T') do set CDATE=%%B
for /F "tokens=1,2 eol=/ delims=/ " %%A in ('date /T') do set mm=%%B
for /F "tokens=1,2 delims=/ eol=/" %%A in ('echo %CDATE%') do set dd=%%B
for /F "tokens=2,3 delims=/ " %%A in ('echo %CDATE%') do set yyyy=%%B
set datePart=%yyyy%-%mm%-%dd%
set backPath=D:\Backup\Back-%datePart%
@pwelter34
pwelter34 / gist:539e568d3b95f4071f08
Last active September 10, 2015 14:07
Fluent Example
public void HttpClientPost(){
// post data
var post = new Dictionary<string, string>()
{
{ "grant_type", "refresh_token" },
{ "client_id", consumerkey },
{ "client_secret", consumerSecret },
{ "refresh_token", refreshToken }
};
var content = new FormUrlEncodedContent(post);
@pwelter34
pwelter34 / DataGenerator.cs
Last active September 23, 2015 04:10
Fluent interface for data generator prototype
public class TestCase
{
public void Configure()
{
DataGenerator.Configue(c => c
.Entity<User>(m =>
.AutoMap()
.Map(e => {
e.Property(p => p.FirstName).DataSource<FirstNameSource>();
e.Property(p => p.LastName).DataSource<LastNameSource>();
@pwelter34
pwelter34 / MongoRepository.cs
Last active December 12, 2015 06:48
MongoDB Repository
public class MongoRepository<TEntity>
where TEntity : class
{
private static readonly Lazy<string> _collectionName;
private static int _mappingInitialized = 0;
private static int _indexingInitialized = 0;
private readonly Lazy<MongoCollection<TEntity>> _collection;
private readonly MongoUrl _mongoUrl;
@pwelter34
pwelter34 / gist:5514047
Created May 3, 2013 20:53
NLog.Mongo default document
{
"_id" : ObjectId("5184219b545eb455aca34390"),
"TimeStamp" : ISODate("2013-05-03T20:44:11Z"),
"Level" : "Error",
"LoggerName" : "NLog.Mongo.ConsoleTest.Program",
"Message" : "Error reading file 'blah.txt'.",
"Exception" : {
"Message" : "Could not find file 'C:\\Projects\\github\\NLog.Mongo\\Source\\NLog.Mongo.ConsoleTest\\bin\\Debug\\blah.txt'.",
"Text" : "System.IO.FileNotFoundException: Could not find file 'C:\\Projects\\github\\NLog.Mongo\\Source\\NLog.Mongo.ConsoleTest\\bin\\Debug\\blah.txt'.\r\nFile name: 'C:\\Projects\\github\\NLog.Mongo\\Source\\NLog.Mongo.ConsoleTest\\bin\\Debug\\blah.txt'\r\n at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)\r\n at System.IO.FileS
@pwelter34
pwelter34 / gist:5514092
Created May 3, 2013 20:59
NLog.Mongo custom format
{
"_id" : ObjectId("5184219b545eb455aca34391"),
"Date" : "2013-05-03 15:44:11.7942",
"Level" : "Error",
"Message" : "Error reading file 'blah.txt'.",
"Logger" : "NLog.Mongo.ConsoleTest.Program",
"Exception" : "System.IO.FileNotFoundException: Could not find file 'C:\\Projects\\github\\NLog.Mongo\\Source\\NLog.Mongo.ConsoleTest\\bin\\Debug\\blah.txt'.\r\nFile name: 'C:\\Projects\\github\\NLog.Mongo\\Source\\NLog.Mongo.ConsoleTest\\bin\\Debug\\blah.txt'\r\n at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)\r\n at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLong
@pwelter34
pwelter34 / gist:7933029
Created December 12, 2013 18:34
slider css
/* slider */
.sliderLabel
{
border: 1px solid;
border-color: #e4e4e4 #e4e4e4 #bebebe;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
-ms-border-radius: 5px;
border-radius: 5px;