Skip to content

Instantly share code, notes, and snippets.

View johnnyreilly's full-sized avatar

John Reilly johnnyreilly

View GitHub Profile
@johnnyreilly
johnnyreilly / PdfGenerator.cs
Created April 9, 2012 05:58
C# Wrapper for WKHTMLtoPDF
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Web;
using System.Web.Hosting;
namespace PdfGenerator
{
public class PdfGenerator
@johnnyreilly
johnnyreilly / DateTimeJavaScriptConverter.cs
Created April 25, 2012 14:10
The 3 elements needed to have a nice JavaScriptSerializer DateTime experience in older browsers and using ASP.NET WebForms
using System;
using System.Collections;
using System.Collections.Generic;
using System.Web.Script.Serialization;
namespace MyNamespace
{
/// <summary>
/// A custom DateTime JavaScriptConverter courtesy of these good folks: http://blog.calyptus.eu/seb/2011/12/custom-datetime-json-serialization/
/// Using this forces DataTimes to be serialised as ISO 8601 rather "\/Date(1249335477787)\/" style
@johnnyreilly
johnnyreilly / ScriptExtensions.cs
Created June 29, 2012 16:51
HTML Helper for creating / rendering scripts when working in ASP.NET MVC (heavily based on Michael Ryans original work; see links enclosed)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;
using System.Text;
namespace DummyMvc.Helpers
{
@johnnyreilly
johnnyreilly / PartialExtensions.cs
Created August 24, 2012 11:31
HTML Helper for rendering attribute encoded PartialViews
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Html;
namespace My.Helpers
{
/// <summary>
/// MVC HtmlHelper extension methods - html element extensions
/// </summary>
public static class PartialExtensions
@johnnyreilly
johnnyreilly / GlobalizeUrls.cs
Last active October 10, 2015 06:58
A monkey patch for jquery.validate.js that allows validation to be internationalised
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Hosting;
using System.IO;
using System.Globalization;
namespace My.Helpers
{
@johnnyreilly
johnnyreilly / Crm.svc.cs
Created September 22, 2012 05:50
A class which when added to a web application exposes the provides an OData service on top of CRM / xRM
using System;
using System.Collections.Generic;
using System.Data.Services;
using System.Data.Services.Common;
using System.Linq;
using System.Web;
using System.ServiceModel.Web;
using Microsoft.Xrm.Client;
using log4net;
@johnnyreilly
johnnyreilly / BundleConfig.cs
Created October 5, 2012 12:15
Using Web Optimization with MVC 3
using System.Web;
using System.Web.Optimization;
namespace WebOptimizationWithMvc3.App_Start
{
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
@johnnyreilly
johnnyreilly / HomeController.cs
Created October 22, 2012 14:34
Documenting a JsonValueProviderFactory Gotcha (MVC 3 meet Dictionary)
//...
[HttpPost]
public ActionResult PostDictionary(Dictionary<string, string> myDictionary)
{
return Json(myDictionary);
}
//...
@johnnyreilly
johnnyreilly / Contact.cs
Created November 2, 2012 11:21
Demo of how to easily serialize and deserialize objects to and from XML
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.239
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
@johnnyreilly
johnnyreilly / BloombergApi.cs
Created November 13, 2012 13:41
Giving OpenBloomberg a nicer API
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bloomberglp.Blpapi;
namespace BloombergConsole
{
class BloombergApi