Skip to content

Instantly share code, notes, and snippets.

@mattkruskamp
mattkruskamp / Asyncronizer.cs
Created August 25, 2015 06:01
.Net Problem: Async and Windowless Forms
using System;
using System.ComponentModel;
using System.Threading;
/// <summary>
/// Class that allows multithread syncronization
/// from asyncronous calls. Anything wrapped with
/// the syncronize method will be executed on the
/// same thread as where the AsyncSyncronizer
/// is instantiated.
@mattkruskamp
mattkruskamp / daily.cs
Created August 25, 2015 05:51
Daily WTF Material
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
@mattkruskamp
mattkruskamp / web.config
Created August 25, 2015 04:41
Asp.Net Membership and Roles Tutorials
<connectionStrings>
<add name=“TestConnection"
connectionString="your connection string here”/>
</connectionStrings>
@mattkruskamp
mattkruskamp / LinkedList.cs
Created August 25, 2015 03:17
C# Tutorial: Linked List
using System;
namespace Systepic.Collections
{
/// <summary>
/// Event Handler designed to be thrown
/// when a collection’s list items change.
/// </summary>
/// <param name=“sender”>The list that
/// fired the event.</param>
@mattkruskamp
mattkruskamp / MyTags.tld
Created August 25, 2015 02:51
J2EE Custom Simple Tags Part 1
<?xml version=“1.0” encoding=“iso-8859-1” ?>
<taglib xmlns=“http://java.sun.com/xml/ns/j2ee”
xmlns:xsi=“http://www.w3c.org/2001/XMLSchema-instance”
xsi:schemaLocation=“http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd”
version=“2.0”>
<tlib-version>1.2</tlib-version>
<uri>myTags</uri>
<tag>
<description>Custom tags</description>
<name>Square</name>
@mattkruskamp
mattkruskamp / Default.aspx
Created August 24, 2015 21:39
Creating Webparts
<div>
<asp:WebPartManager ID=“WebPartManager1” runat=“server”>
</asp:WebPartManager>
<asp:DropDownList ID=“DropDownList1” runat=“server”>
</asp:DropDownList>
</div>
<div>
<asp:WebPartZone ID=“WebPartZone1” runat=“server”>
</asp:WebPartZone>
</div>
@mattkruskamp
mattkruskamp / index.html
Created August 24, 2015 21:28
Creating Tableless Forms
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml” >
<head runat=“server”>
<title>Untitled Page</title>
<style type=“text/css”>
fieldset {
width: 250px;
@mattkruskamp
mattkruskamp / Page.xaml
Created August 24, 2015 21:18
Publishing Silverlight 2 Beta
<UserControl x:Class=“SilverlightDeploy.Page”
xmlns=“http://schemas.microsoft.com/client/2007”
xmlns:x=“http://schemas.microsoft.com/winfx/2006/xaml”
Width=“400" Height="300”>
<Grid x:Name=“LayoutRoot" Background="White”>
<Button x:Name=“BtnHelloWorld" Content="Hello World”
Width=“100" Height="50" Click="BtnHelloWorld_Click” />
</Grid>
</UserControl>
@mattkruskamp
mattkruskamp / BuildNumber.cs
Created August 24, 2015 08:31
Automatically Breaking Js and Css Cache Using Build Number in Asp.Net
public static string BuildNumber(this HtmlHelper html)
{
if (html.ViewContext.HttpContext.Cache["_buildnumber_"] == null)
{
var version = System.Reflection.Assembly
.GetExecutingAssembly().GetName().Version;
html.ViewContext.HttpContext.Cache["_buildnumber_"] =
version.Build.ToString();
}
return html.ViewContext.HttpContext.Cache["_buildnumber_"].ToString();
@mattkruskamp
mattkruskamp / site.html
Created August 24, 2015 08:28
Pinterest-Style Modal Popup Scrolling in Javascript
<html>
<head>
<style type="text/css">
.container {
width: 100%;
color: #ccc;
}
.large-content {
width: 800px;
margin: 0px auto;