Skip to content

Instantly share code, notes, and snippets.

@jpoehls
jpoehls / ImageResizer.cs
Created September 8, 2009 13:44
ImageResizer
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
namespace Boo
{
public class ImageResizer
@jpoehls
jpoehls / TokenReplacementMasterPage.cs
Created September 8, 2009 13:51
TokenReplacementMasterPage
using System;
using System.Text;
using System.IO;
using System.Web.UI;
namespace Boo
{
public class TokenReplacementMasterPage : System.Web.UI.MasterPage
{
protected override void Render(HtmlTextWriter writer)
@jpoehls
jpoehls / generate_tags.rb
Created October 3, 2009 23:32 — forked from alexyoung/generate_tags.rb
Jekyll Tags Page
namespace :tags do
task :generate do
puts 'Generating tags...'
require 'rubygems'
require 'jekyll'
include Jekyll::Filters
options = Jekyll.configuration({})
site = Jekyll::Site.new(options)
site.read_posts('')
@jpoehls
jpoehls / gist:201768
Created October 5, 2009 02:17
Clears ASP.NET control values
public static void ClearControlValues(
Control parentCtrl, bool recursive)
{
ClearControlValues(parentCtrl, recursive,
new List<Control>(0));
}
public static void ClearControlValues(
Control parentCtrl, bool recursive,
List<Control> ignoreControls)
@jpoehls
jpoehls / gist:201827
Created October 5, 2009 02:51
ASP.NET DropDownList SelectedValue & ViewState
protected string MySelectedValue
{
get
{
return (ViewState["MySelectedValue"] == null)
? null : ViewState["MySelectedValue"].ToString();
}
set
{
ViewState["MySelectedValue"] = value;
@jpoehls
jpoehls / SuperValidator.cs
Created October 19, 2009 16:26
WinForms validation based on IExtenderProvider
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace Controls
{
[ProvideProperty("Required", typeof(Control))]
@jpoehls
jpoehls / MainPage.xaml
Created January 8, 2010 02:41
ResourceDictionary error in Silverlight
<UserControl x:Class="ResourceDictionaryHeadache.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<UserControl.Resources>
<ResourceDictionary Source="/SampleData.xaml" />
</UserControl.Resources>
<Grid x:Name="LayoutRoot">
<ListBox HorizontalAlignment="Stretch"
@jpoehls
jpoehls / SerializationInfoHelper.cs
Created March 19, 2010 19:19
a SerializationInfoHelper class that makes it easier to pull values out of SerializationInfo
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Helpers
{
public class SerializationInfoHelper
{
private readonly SerializationInfo _info;
private bool _enumerated = false;
@jpoehls
jpoehls / WinFormsControlExtensions.cs
Created April 7, 2010 13:36
WPF & WinForms Control Extensions
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Windows.Forms;
namespace Samples
@jpoehls
jpoehls / CascadingListDecorator.cs
Created April 18, 2010 01:05
CascadingListDecorator for WinForms
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace Samples
{
public class CascadingListDecorator<TChildValue, TParentValue> where TParentValue : class
{
private ListControl _childList;