Skip to content

Instantly share code, notes, and snippets.

View xerxesb's full-sized avatar

Xerxes Battiwalla xerxesb

View GitHub Profile
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Class="HelloWOrld.MainPage"
Width="640" Height="480" mc:Ignorable="d">
<UserControl.Resources>
<Storyboard x:Name="Storyboard2">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="border" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)">
<EasingDoubleKeyFrame KeyTime="00:00:00" Value="-99"/>
@xerxesb
xerxesb / Raise.Event<AsyncEventArgs>() fails
Created November 1, 2010 12:29
Raise.Event<AsyncEventArgs>() fails
Booyah.ShouldJustWork : FailedSystem.InvalidOperationException : Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at System.Collections.Generic.List`1.Enumerator.MoveNext()
at NSubstitute.Routing.Handlers.RaiseEventHandler.Handle(ICall call) in d:\Git\NSubstitute\Source\NSubstitute\Routing\Handlers\RaiseEventHandler.cs: line 27
at NSubstitute.Routing.Route.<>c__DisplayClass3.<Handle>b__0(ICallHandler x) in d:\Git\NSubstitute\Source\NSubstitute\Routing\Route.cs: line 18
at System.Linq.Enumerable.<>c__DisplayClass12`3.<CombineSelectors>b__11(TSource x)
at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source, Func`2 predicate)
at NSubstitute.Routing.Route.Handle(ICall call) in d:\Git\NSubstitute\Source\NSubstitute\Routing\Route.cs: line 18
@xerxesb
xerxesb / AssertWasCalled
Created May 11, 2011 10:28
Using Fasterflect to invoke AssertWasCalled<T>(this T mock, Action<T>)
This doesn't work - it says "No match for method with name AssertWasCalled and flags Instance | NonPublic | Public | Static on type Rhino.Mocks.RhinoMocksExtensions"
public static void CallUsingReflection<T>(T mock, Action<T> action)
{
RhinoAssembly.GetType("Rhino.Mocks.RhinoMocksExtensions").CallMethod(new[] { typeof(T) }, "AssertWasCalled", new object[] { mock, action });
}
@xerxesb
xerxesb / about.md
Created August 9, 2011 23:27 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer
@xerxesb
xerxesb / gist:1208285
Created September 10, 2011 13:05
NSubstitute: Stack Empty exception
Bug or am i doing something stupid? Want to pretend that the first call to menu.PrintMenu() in GetSelection never happened by clearing received calls from the sub itself.
[TestFixture]
public class NSubBug
{
public interface IMenu
{
void PrintMenu();
string GetUserSelection();
}
@xerxesb
xerxesb / ngnix.conf
Created October 10, 2011 21:37
Suck my noolie
gist.
@xerxesb
xerxesb / gistformyles
Created January 30, 2012 04:05
Example of gists on github
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sed ipsum sem, quis vestibulum tortor. Curabitur facilisis malesuada urna, in auctor eros congue a. Suspendisse consequat tellus id erat aliquam cursus. Ut gravida augue eu lectus molestie a condimentum justo dictum. Ut adipiscing dictum nulla, nec sagittis mi pellentesque in. Aenean nec rutrum mauris. Donec pharetra velit ut est euismod volutpat. Sed vel lectus elit. Sed nunc risus, aliquet sed luctus ut, dictum sit amet libero. Nulla erat risus, tempus nec porta id, ultrices vitae libero. Vestibulum tristique imperdiet neque vel commodo. Mauris sit amet leo quis nisl convallis cursus non non lacus. Fusce adipiscing turpis metus, id laoreet orci. Etiam et scelerisque nisi. Vivamus ipsum metus, pellentesque non porttitor eget, sollicitudin non velit. Quisque egestas elementum euismod.
Maecenas tincidunt, tortor id consectetur congue, quam velit ultricies tortor, ut vulputate erat quam a elit. Nulla facilisi. Nam mollis feugiat augue, at posuere m
@xerxesb
xerxesb / commbankcheckboxes
Created January 30, 2012 10:03
Dynamic checkboxes in a table
// Given a list of table rows, I want to prepend (or append) a blank checkbox which i'll use to
// check off as i go through the rows one by one....this should work on the netbank site.
// the idea is to just keep this as a bookmarklet and run it when looking at my transaction list
// When running the snip below chrome complains "Uncaught Error: NOT_FOUND_ERR: DOM Exception 8"
javascript:$('#transactionsTableBody > tr').map(function() { this.appendChild($('<td><input type="checkbox" /></td>')) })
@xerxesb
xerxesb / gist:1744913
Created February 5, 2012 11:39
Netbank hackery
var BetterNetbank = {
inject: function(table) {
if ($("#" + table).length > 0) {
$('#' + table + ' thead tr').prepend('<th>X</th>');
$('#' + table + 'Body > tr').map(function() {
$(this).prepend('<td><input type="checkbox" /></td>');
});
}
}
}
@xerxesb
xerxesb / gist:2788221
Created May 25, 2012 13:38
Xerxes solutions to typeclass problems
data List a = Elem a | List [List a] deriving (Show)
flatten' :: List a -> [a]
flatten' (Elem x) = [x]
flatten' (List (x:xs)) = flatten' x ++ flatten' (List xs)
flatten' (List []) = []
data Tree a = Empty | Node a (Tree a) (Tree a)
deriving (Eq, Show, Read)