Skip to content

Instantly share code, notes, and snippets.

@jpoehls
jpoehls / Window1.xaml
Created May 22, 2009 12:28
WPF Popup Keypad spike
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Popup Tester" Height="300" Width="300">
<Window.Resources>
<Style TargetType="{x:Type TextBox}">
<Setter Property="Margin" Value="10" />
<EventSetter Event="GotKeyboardFocus" Handler="run_MouseEnter" />
</Style>
@jpoehls
jpoehls / ImageResizer.cs
Created September 7, 2009 15:36
ImageResizer + ImageUtility
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
namespace ImageTools
{
public class ImageResizer
@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;