Skip to content

Instantly share code, notes, and snippets.

View teamaton's full-sized avatar

teamaton teamaton

  • teamaton UG
  • Emmingen-Liptingen - Mannheim - Leipzig - Falkensee
View GitHub Profile
@teamaton
teamaton / TrimTextBox.cs
Last active September 21, 2016 23:10
A special-purpose TextBox derivative that automatically trims whitespace from its Text value.
/// LICENSE: MIT
using System.Web.UI.WebControls;
namespace Generic.Frontend.Web
{
public class TrimTextBox : TextBox
{
/// <summary>
/// Returns the text entered, but with leading and trailing whitespace removed.
@teamaton
teamaton / CampsiteSetup.cs
Created January 16, 2016 16:01
Evolution of object creation code in tests
namespace CampingInfo.Core.Setup
{
public class CampsiteSetup
{
}
}
@teamaton
teamaton / locations.ini
Created November 14, 2015 12:28
locations.ini for WPT server
[locations]
1=first
default=first
[first]
1=first_wptdriver
2=first_ie
label="My first agent"
default=first_wptdriver
@teamaton
teamaton / disable-fusion-log.ps1
Last active November 6, 2023 12:53
FusionLog - enable and disable
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name ForceLog
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogFailures
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogResourceBinds
Remove-ItemProperty -Path HKLM:\Software\Microsoft\Fusion -Name LogPath
@teamaton
teamaton / jquery.tn.move-restore.js
Last active August 29, 2015 14:23
A jQuery plugin to move around HTML in your DOM and restore it when necessary
// author: oliver@teamaton.com
// LICENSE: MIT
(function($) {
$.fn.moveTo = function(target, method) {
method = method || "appendTo";
var randomNumber = Date.now().toString() + (10 ^ 6 * Math.random().toPrecision(6));
var placeholderId = "placeholder-" + randomNumber;
var $content = $(this).replaceWith("<script id='" + placeholderId + "' type='text/html'></" + "script>");
// same as $content.appendTo($(target)) but with variable method ;-)
$content[method]($(target));
@teamaton
teamaton / ConcreteTypeConverter
Created April 7, 2015 23:10
JSON.NET: ConcreteTypeConverter and ConcreteTypeListConverter classes for deserialization of interface properties
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
public class ConcreteTypeConverter<TConcrete> : JsonConverter {
public override bool CanConvert(Type objectType) {
//this method is *not* called when using the JsonConverterAttribute to assign a converter
return objectType.IsAssignableFrom(typeof (TConcrete));
}
@teamaton
teamaton / gist:7639546
Created November 25, 2013 10:47
Extract full test method name from currently running SpecFlow scenario
private static void SaveTestNameToFailedTestsFile() {
var scenarioDesc = ScenarioContext.Current.ScenarioInfo.Title;
var methodInfos = typeof (InfrastructureSteps).Assembly.GetTypes()
.SelectMany(
type => type.GetMethods()
.Where(m => m.GetCustomAttributes(typeof (DescriptionAttribute), false)
.Any(attr => ((DescriptionAttribute) attr).Description == scenarioDesc)));
foreach (var methodInfo in methodInfos) {
var fullMethodName = methodInfo.ReflectedType.FullName + "." + methodInfo.Name;
@teamaton
teamaton / make-and-copy.bat
Created July 15, 2011 06:58
Zipping and copying a VS multi-file item template
@echo off
:echo %~p0
REM
REM retrieve the name of the last folder in the path
REM
SET mydir=%~p0
SET mydir=%mydir:\= %
for %%a in (%mydir%) do set LastFolder=%%~nxa