Skip to content

Instantly share code, notes, and snippets.

View tathamoddie's full-sized avatar

Tatham Oddie tathamoddie

View GitHub Profile
@tathamoddie
tathamoddie / Home.aspx
Created March 29, 2010 23:16
Tixi homepage teaser
<%@ Page Language="C#" MasterPageFile="~/tixi/Masters/Default.Master" AutoEventWireup="true" CodeBehind="Home.aspx.cs" Inherits="FuelAdvance.Galapagos.WebUI.tixi.Home" EnableViewState="False" Title="" %>
<%@ Register TagPrefix="tixi" TagName="Step1" Src="~/Components/GettingStarted/Step1/Step1Control.ascx" %>
<asp:Content ContentPlaceHolderID="NoFormPlaceHolder" runat="server">
<div id="homepage-content">
<div id="signup-teaser">
<div class="image-panel">
<span class="images">
<img runat="server"
src="~/App_Themes/Default/Assets/HomepagePanelTrackDay.jpg"
alt="Revving up a day on the track?"
@tathamoddie
tathamoddie / AccountsDashboard.aspx
Created April 13, 2010 00:13
Example of nested presenters with Web Forms MVP
<%@ Register Src="~/Controls/AccountsDashboard.ascx" TagPrefix="app" TagName="dashboard" %>
<app:Dashboard runat="server" />
@tathamoddie
tathamoddie / gist:371001
Created April 19, 2010 12:43
Enumerable.SetEqual<T> extension
/// <summary>
/// An order independent version of <see cref="Enumerable.SequenceEqual{TSource}(System.Collections.Generic.IEnumerable{TSource},System.Collections.Generic.IEnumerable{TSource})"/>.
/// </summary>
internal static bool SetEqual<T>(this IEnumerable<T> x, IEnumerable<T> y)
{
if (x == null) throw new ArgumentNullException("x");
if (y == null) throw new ArgumentNullException("y");
var objectsInX = x.ToList();
var objectsInY = y.ToList();
@tathamoddie
tathamoddie / geolocation.htm
Created June 3, 2010 00:49
Geolocation API demo
<!DOCTYPE html>
<html>
<head>
<style type="text/css">html { font-size: 200%; }</style>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
$(function () {
$("#find-link").click(function (e) {
@tathamoddie
tathamoddie / Merge-Assets.cmd
Created June 21, 2010 01:03
Web asset merging with PowerShell
@echo off
setlocal
set tempscript=%temp%\%~n0.%random%.ps1
echo $ErrorActionPreference="Stop" >"%tempscript%"
echo ^& "%~dpn0.ps1" %* >>"%tempscript%"
powershell.exe -command "& \"%tempscript%\""
set errlvl=%ERRORLEVEL%
del "%tempscript%"
exit /b %errlvl%
@tathamoddie
tathamoddie / Publish-Version.ps1
Created June 22, 2010 04:54
Copies /Static/Base/ to /Static/v1234/ where 1234 is derived from the TFS version number
#requires -Version 2
[CmdletBinding()]
param (
$VersionIdentifier
)
$ErrorActionPreference = "Stop"
Set-PSDebug -Strict
$PSScriptFilePath = (Get-Item $MyInvocation.MyCommand.Path).FullName
namespace TechList
{
[TestFixture]
public class Luke
{
class DemoObject
{
public string GroupId { get; set; }
public int GroupCount { get; set; }
}
@tathamoddie
tathamoddie / Export-Minified.ps1
Created July 14, 2010 00:50
PowerShell wrapper for AjaxMin.dll
#requires -Version 2
[CmdletBinding()]
param (
[parameter(Mandatory=$true)]
$InputPath
)
$ErrorActionPreference = "Stop"
void Test()
{
new UnitOfWork()
.AddWork(SomeMethod, 123.5)
.AddWork(SomeOtherMethod, "hello", 123);
}
void SomeMethod(double something)
{
public static void RegisterStyleSheets(this Page page, IEnumerable<string> appRelativePaths)
{
if (page == null) throw new ArgumentNullException("page");
if (page.Header == null) throw new ArgumentException("Page header is unavailable.", "page");
var links = appRelativePaths
.Select(page.ResolveClientUrl)
.Select(p =>
{
var link = new HtmlLink { Href = p };