Skip to content

Instantly share code, notes, and snippets.

[TestFixture]
public class InheritedFixture
{
protected int _setupValue;
[SetUp]
public void ShouldNotRun()
{
_setupValue = 10;
}
@staxmanade
staxmanade / gist:750864
Created December 22, 2010 00:16
RadDocumentViewerViewModel
Public Class RadDocumentViewerViewModel
Private pdfWebControl As PdfWebControl
Property ControlID As String = Guid.NewGuid.ToString().Replace("-", "")
Property DocumentKey As String
Sub New(ByVal specialDocumentKey As String, ByVal documentName As Func(Of String), ByVal fileContents As Func(Of Byte()))
pdfWebControl = New PdfWebControl()
@staxmanade
staxmanade / gist:750881
Created December 22, 2010 00:27
RadDocumentViewerViewModel view
<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl(Of RadDocumentViewerViewModel)" %>
<div id="rad_document_viewer_container" style="height:100%;">
<iframe src="<%= Model.IFrameSrc %>" id="<%= Model.ControlID %>" frameborder="0" style="height:100%; width:100%; border: 0px none rgb(255, 255, 255);"></iframe>
</div>
@staxmanade
staxmanade / Get-Last-NuGet-Version
Created June 6, 2011 04:09
Powershell function that returns the last version of a NuGet package
function Get-Last-NuGet-Version($nuGetPackageId) {
$feeedUrl = "http://packages.nuget.org/v1/FeedService.svc/Packages()?`$filter=Id%20eq%20'$nuGetPackageId'"
$webClient = new-object System.Net.WebClient
$queryResults = [xml]($webClient.DownloadString($feeedUrl))
$version = $queryResults.feed.entry | %{ $_.properties.version } | sort-object | select -last 1
if(!$version){
$version = "0.0"
}
$version
}
@staxmanade
staxmanade / gist:1059430
Created July 1, 2011 21:26
Pseudo code I think could be used to leverage StatLight.Core
using System;
using System.Collections.ObjectModel;
using StatLight.Client.Harness.Events;
using StatLight.Core.Common;
using StatLight.Core.Configuration;
using StatLight.Core.Events;
using StatLight.Core.Events.Aggregation;
using StatLight.Core.Reporting;
using StatLight.Core.Runners;
using StatLight.Core.WebBrowser;
@staxmanade
staxmanade / gist:1180060
Created August 30, 2011 02:57
Fun(for a 4yr old) - little powershell speak what you type (
function Start-The-Fun()
{
$voice = new-object -com SAPI.SpVoice;
while($true)
{
write-host "->" -NoNewLine;
$msg = read-host;
$Voice.Speak( $msg, 1 ) | out-null;
}
@staxmanade
staxmanade / EnumerableEx.cs
Created October 5, 2011 18:02
Concating enumerables (just a thought)
public static class EnumerableEx
{
public static IEnumerable<T> Concat<T>(params IEnumerable<T>[] enumerables)
{
if (enumerables == null) throw new ArgumentNullException("enumerables");
return enumerables.SelectMany(i => i);
}
}
@staxmanade
staxmanade / StaticCLassItemMetadata.cs
Created January 13, 2012 06:39
Sort of like an Enum with more data or behavior possibilities.
public class Sample
{
[Test]
public void MetadataSample()
{
Items.ItemA.ShouldEqual(Items.ItemA);
Items.ItemA.Description.ShouldEndWith("Description for A");
}
}
@staxmanade
staxmanade / Where.ps1
Created April 5, 2012 03:23 — forked from ferventcoder/Where.ps1
Somebody's where.exe implementation as powershell ;)
function where-is($command) {
(ls env:\path).Value.split(';') | `
where { $_ } | `
%{ [System.Environment]::ExpandEnvironmentVariables($_) } | `
where { test-path $_ } |`
%{ ls "$_\*" -include *.bat,*.exe,*cmd } | `
%{ $file = $_.Name; `
if($file -and ($file -eq $command -or `
$file -eq ($command + '.exe') -or `
$file -eq ($command + '.bat') -or `
@staxmanade
staxmanade / gist:2562639
Created April 30, 2012 20:58
FizzBuzz - Javascript
var msg;
// FizzBuzz 1
for(var i = 1; i <=100; i++, msg = ''){
if(i % 5 === 0)
msg = 'Buzz';
if(i % 3 === 0)
msg += 'Fizz';