Skip to content

Instantly share code, notes, and snippets.

View cmillr's full-sized avatar

Chad Miller cmillr

  • Jackson, Mississippi
View GitHub Profile
@cmillr
cmillr / parser.php
Created May 1, 2012 01:56
Use Composer-Installed twig with FuelPHP
<?php
// Assuming composer's configured 'vendor' directory is APPPATH/vendor/, this configuration
// file will tell fuel's parser library where to find the twig resource files.
// Place this file inside your APPPATH/config directory.
return array(
'View_Twig' => array(
'include' => APPPATH.'vendor'.DS.'twig'.DS.'twig'.DS.'lib'.DS.'Twig'.DS.'Autoloader.php',
@cmillr
cmillr / BootstrapHtmlHelper.cs
Created November 22, 2013 16:54
Provides a standard input control for forms on Bootstrap, along with inline validation messages and highlighting.
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Web.Mvc;
using System.Web.Mvc.Html;
public static class BootstrapHtmlHelper
{
public static MvcHtmlString BootstrapInputFor<TModel, TProp>(this HtmlHelper<TModel> helper, Expression<Func<TModel, TProp>> expr, string name)
{
@cmillr
cmillr / ToXml.cs
Created January 17, 2014 20:38
This class contains only an extension method to all types that converts any arbitrary object to an XML tag tree.
using System.IO;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
public static partial class Converter
{
public static string ToXml<T>(this T TheObject)
{
var Serializer = new XmlSerializer(typeof(T));
@cmillr
cmillr / TestDataReader
Created April 14, 2014 20:04
This gets CSV values in property syntax for data-driven tests
using System;
using System.Dynamic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
public class TestDataReader : DynamicObject
{
private readonly TestContext _testContextInstance;
public TestDataReader(TestContext testContext)