Skip to content

Instantly share code, notes, and snippets.

View ksummerlin's full-sized avatar

Kelly Summerlin ksummerlin

View GitHub Profile
@ksummerlin
ksummerlin / gist:963841
Created May 10, 2011 03:07
Here is a LinqPad example of KeyPressed e.Handled
//You'll have to run this example in LinqPad as a C# program.
//Or put a class around the two global methods and change .Dump() calls to Console.WriteLine
void Main()
{
var frm = new Form1();
frm.Controls[0].KeyPress += keypressed_inMain;
frm.ShowDialog();
}
@ksummerlin
ksummerlin / SlowLoadableComponent.cs
Created May 4, 2012 02:43
SlowLoadableComponent implementation
// <copyright file="SlowLoadableComponent.cs" company="WebDriver Committers">
// Copyright 2007-2011 WebDriver committers
// Copyright 2007-2011 Google Inc.
// Portions copyright 2011 Software Freedom Conservancy
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
@ksummerlin
ksummerlin / DefaultPageObject.cs
Created May 4, 2012 03:00
Example - Simple LoadableComponent in .NET
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
public class DefaultPageObject : LoadableComponent<DefaultPageObject>
{
readonly IWebDriver driver;
@ksummerlin
ksummerlin / CustomerProgramsPageObject.cs
Created May 4, 2012 03:18
Example SlowLoadableComponent page object
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using OpenQA.Selenium;
using OpenQA.Selenium.Support.PageObjects;
using OpenQA.Selenium.Support.UI;
using Selenium.ExtJs.Support.Locators;
select top 3
OH.SalesOrderID,
OH.CustomerId,
OH.SalesOrderNumber,
OH.Status
from Sales.SalesOrderHeader OH
where
OH.CustomerID = @customer_id
and OH.SalesOrderID <> @current_sales_id
order by OH.OrderDate
void FillOtherOrdersSection() {
GetOtherOrders(); //Calls stored procedure to fill _otherOrders
foreach (var otherOrder in _otherOrders) {
if (string.IsNullOrEmpty(otherOrder.Status)) {
status = "";
} else {
status = " - " + otherOrder.Status;
}
MakeOrderLink(otherOrder);
}
void FillOtherOrdersSection(int maxOtherOrders) {
GetOtherOrders(maxOtherOrders); //Calls stored procedure to fill _otherOrders
foreach (var otherOrder in _otherOrders) {
if (string.IsNullOrEmpty(otherOrder.Status)) {
status = "";
} else {
status = " - " + otherOrder.Status;
}
MakeOrderLink(otherOrder);
}
--@max_other_orders is a parameter to stored proc
select top (@max_other_orders)
OH.SalesOrderID,
OH.CustomerId,
OH.SalesOrderNumber,
OH.Status,
count(*) over(partition by OH.CustomerId) as OtherOrdersCount
from Sales.SalesOrderHeader OH
where
OH.CustomerID = @customer_id
@ksummerlin
ksummerlin / git-svn-diff.sh
Created July 26, 2012 19:19 — forked from nmacinnis/git-svn-diff.sh
Windows and TortoiseSVN-friendly modifications
#!/bin/bash
#
# git-svn-diff originally by (http://mojodna.net/2009/02/24/my-work-git-workflow.html)
# modified by mike@mikepearce.net
# modified by aconway@[redacted] - handle diffs that introduce new files
#
# Generate an SVN-compatible diff against the tip of the tracking branch
# Get the tracking branch (if we're on a branch)
TRACKING_BRANCH=`git svn info | grep URL | sed -e 's/.*\/branches\///'`
@ksummerlin
ksummerlin / illegal_static_constructor
Created May 1, 2013 14:50
The concept of a static constructor does not exist in the TypeScript language (as of v0.8.3)
class Foo {
static baseTime: Date;
static constructor() {
Foo.baseTime = new Date();
Foo.baseTime.setMilliseconds(0);
}
}