Skip to content

Instantly share code, notes, and snippets.

@pawelpabich
pawelpabich / gist:1971234
Created March 4, 2012 08:13
Normalizes MbUnit test results so they can be viewed in Visual Studio
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
namespace MbUnitTestResultNormalizer
{
public class TestResultNormalizer
{
@pawelpabich
pawelpabich / gist:1985843
Created March 6, 2012 11:48
Windows 8 Developer Preview jQuery hack
msWWA.execUnsafeLocalFunction(function () {
self[i].innerHTML = value;
});
@pawelpabich
pawelpabich / gist:2300832
Created April 4, 2012 12:39
Unit of work
public class UnitOfWork : IUnitOfWork, IDisposable
{
private readonly MyContext context;
private bool isRolledback;
private readonly TransactionScope transactionScope;
public UnitOfWork(MyContext context)
{
this.context = context;
isRolledback = false;
@pawelpabich
pawelpabich / LogModule.cs
Created July 7, 2012 13:32
Log4Net and NLog modules for Autofac
using System;
using System.Linq;
using Autofac;
using Autofac.Core;
using NLog;
using log4net;
using LogManager = NLog.LogManager;
namespace AutofacIdea
{
@pawelpabich
pawelpabich / html.html
Created October 30, 2012 08:49
Java Script unit testing with YUI Test and Jack mocking framework
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title></title>
<script src="Scripts/Form.js" type="text/javascript"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"> </script>
</head>
<body>
<form method="post" action="">
<p>Why did you decided to submit this form?</p>
<fieldset><legend>Reasons</legend>
<ul>
@pawelpabich
pawelpabich / test.html
Created October 30, 2012 08:54
Java Script unit testing with YUI Test and Jack mocking framework
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>Untitled Page</title>
<link rel="stylesheet" type="text/css" href="http://developer.yahoo.com/yui/3/assets/yui.css" />
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/3.1.1/build/cssfonts/fonts-min.css" />
<script src="http://yui.yahooapis.com/3.1.1/build/yui/yui-min.js" type="text/javascript"></script>
<script src="Scripts/jack.js" type="text/javascript"></script>
<script src="Scripts/Form.js" type="text/javascript"></script>
<script src="Scripts/UnitTests.js" type="text/javascript"></script>
</head>
@pawelpabich
pawelpabich / test.js
Created October 30, 2012 08:56
Java Script unit testing with YUI Test and Jack mocking framework
/// <reference path="jack.js" />
JST = JSUnitTesting;
YUI().use("node", "console", "test", function (Y) {
var validation_tests = new Y.Test.Case({
name: "Validation tests",
"validation should fail when both custom and
@pawelpabich
pawelpabich / code.js
Created October 30, 2012 08:59
Java Script unit testing with YUI Test and Jack mocking framework
JSUnitTesting = {
getPredefinedReasons: function () {
var values = [];
$("input[type='checkbox']").each(function () {
values.push($(this).is(":checked"));
});
return values;
},
getCustomReason: function () {
return $("input[type='text']:first").val();
@pawelpabich
pawelpabich / InputData.txt
Created January 1, 2013 09:37
Word count using Hive
Hello
World
Bye
World
public class ExtensibleDynamicObject : DynamicObject
{
private readonly Dictionary<string, object> data;
public ExtensibleDynamicObject()
{
data = new Dictionary<string, object>();
}
public override bool TrySetMember(SetMemberBinder binder, object value)