Skip to content

Instantly share code, notes, and snippets.

View bleroy's full-sized avatar

Bertrand Le Roy bleroy

View GitHub Profile
@bleroy
bleroy / XmlHelper.cs
Last active September 18, 2022 03:11
A C# helper class to read and write XML from and to objects
using System;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Xml.Linq;
namespace Nwazet.Commerce.Helpers {
public static class XmlHelper {
/// <summary>
/// Like Add, but chainable.
@bleroy
bleroy / XmlHelperTests.cs
Last active December 16, 2015 05:38
Tests for XmlHelper
using System;
using System.Xml.Linq;
using NUnit.Framework;
using Nwazet.Commerce.Helpers;
namespace Nwazet.Commerce.Tests {
[TestFixture]
public class XmlHelperTests {
[Test]
public void StringToAttribute() {
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
namespace Bleroy.Helpers {
public static class NotNull {
public static TProp Get<TSource, TProp>(this TSource source, Expression<Func<TSource, TProp>> property) where TSource : class {
if (source == null) return default(TProp);
var current = property.Body;
// Flasync Fluent Asynchronous API Helper (c) 2014 Bertrand Le Roy, under MIT. See LICENSE.txt for licensing details.
'use strict';
/**
* @description
* This mix-in adds utility methods and infrastructure to an object
* to help build a fluent and asynchronous API.
* @param {object} thing The object to flasync.
*/
function flasync(thing) {
@bleroy
bleroy / 16335.patch
Created April 1, 2015 22:10
CodePlex Issue #16335 Plain Text Attachments
diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostAdminController.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostAdminController.cs
--- a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostAdminController.cs
+++ b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostAdminController.cs
@@ -1,3 +1,4 @@
+using System;
using System.Web.Mvc;
using Orchard.Blogs.Drivers;
using Orchard.Blogs.Extensions;
@@ -8,14 +9,18 @@
using Orchard.Localization;
@bleroy
bleroy / 16341-supplement.patch
Created April 1, 2015 22:12
CodePlex Issue #16341 Plain Text Attachments
diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostAdminController.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostAdminController.cs
--- a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostAdminController.cs
+++ b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostAdminController.cs
@@ -13,6 +13,7 @@
using Orchard.UI.Admin;
using Orchard.UI.Notify;
using Orchard.Extensions;
+using Orchard.Utility.Extensions;
namespace Orchard.Blogs.Controllers {
@bleroy
bleroy / stack.txt
Created April 1, 2015 22:18
CodePlex Issue #16364 Plain Text Attachments
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
@bleroy
bleroy / stack.txt
Created April 1, 2015 22:18
CodePlex Issue #16367 Plain Text Attachments
Server Error in '/' Application.
Illegal characters in path.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Illegal characters in path.
Source Error:
@bleroy
bleroy / orchardfeed.xml
Created April 1, 2015 22:18
CodePlex Issue #16372 Plain Text Attachments
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<version>1.0.0</version>
<title>Sample Product WebPI v2 RTW Feed</title>
<link href="http://www.contoso.com/SampleProductFeed.xml" />
<updated>2009-9-29T16:30:00Z</updated>
<author>
<name>Sample Product Builder</name>
<uri>http://www.contoso.com</uri>
@bleroy
bleroy / 16373.patch
Created April 1, 2015 22:18
CodePlex Issue #16373 Plain Text Attachments
diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Models/CommentRecord.cs b/src/Orchard.Web/Modules/Orchard.Comments/Models/CommentRecord.cs
--- a/src/Orchard.Web/Modules/Orchard.Comments/Models/CommentRecord.cs
+++ b/src/Orchard.Web/Modules/Orchard.Comments/Models/CommentRecord.cs
@@ -1,5 +1,6 @@
using System;
using Orchard.ContentManagement.Records;
+using Orchard.Data.Conventions;
namespace Orchard.Comments.Models {
public class CommentRecord : ContentPartRecord {