Skip to content

Instantly share code, notes, and snippets.

@orient-man
orient-man / SQLiteForeignKeysTests.cs
Created November 15, 2012 14:59
Explaining SQLite foreign keys support
using System;
using System.Data;
using System.Data.Common;
using System.Data.SQLite;
using NUnit.Framework;
namespace MyApplication.Tests
{
[TestFixture]
public class SQLiteForeignKeysTests
using Castle.DynamicProxy;
namespace MyCompany.Infrastructure.Validation
{
public static class ValidationListenerExtensions
{
public static bool ListenAll(
this IValidationListener listener,
params IValidator[] validators)
{
@orient-man
orient-man / Validation.cs
Created November 15, 2012 16:00
Validation
namespace MyCompany.Infrastructure.Validation
{
// implemented in UI layer
public interface IValidationListener
{
void OnError(string error);
void OnWarning(string warning);
bool IsIgnored(string warning);
}
@orient-man
orient-man / ProxyAndEnumerable.cs
Created November 16, 2012 13:46
How to write interceptor for iterator?
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Castle.DynamicProxy;
using NUnit.Framework;
namespace MyApplication.Tests
{
[TestFixture]
@orient-man
orient-man / CloseConnectionInterceptor.cs
Created November 19, 2012 10:04
Interceptor for managing database connection life cycle
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Castle.DynamicProxy;
namespace MyCompany.Infrastructure
{
class CloseConnectionInterceptor : IInterceptor
{
@orient-man
orient-man / gist:4538958
Last active December 11, 2015 03:38
Disabling blanket.js in IE8 and older
<!--[if gt IE 8]><!-->
<script type="text/javascript" src="blanket.js"></script>
<!--<![endif]-->
Index: blanket.js
===================================================================
--- blanket.js (wersja 21811)
+++ blanket.js (wersja 21812)
@@ -4442,7 +4442,10 @@
}).length === 1;
});
}else{
- selectedScripts = toArray.call(document.querySelectorAll("script[data-cover]"));
+ // orientman: disable if run locally
@orient-man
orient-man / gist:4539471
Created January 15, 2013 15:31
Force Local Intranet with the Mark of the Web (MOTW): http://msdn.microsoft.com/en-us/library/ms537628(v=vs.85).aspx
<!-- saved from url=(0016)http://localhost -->
@orient-man
orient-man / gist:4546935
Created January 16, 2013 12:53
Source code formatting for QUnit reporter
2c2
< var cssSytle = "#blanket-main {margin:2px;background:#EEE;color:#333;clear:both;font-family:'Helvetica Neue Light', 'HelveticaNeue-Light', 'Helvetica Neue', Calibri, Helvetica, Arial, sans-serif; font-size:17px;} #blanket-main a {color:#333;text-decoration:none;} #blanket-main a:hover {text-decoration:underline;} .blanket {margin:0;padding:5px;clear:both;border-bottom: 1px solid #FFFFFF;} .bl-error {color:red;}.bl-success {color:#5E7D00;} .bl-file{width:auto;} .bl-cl{float:left;} .blanket div.rs {margin-left:50px; width:150px; float:right} .bl-nb {padding-right:10px;} #blanket-main a.bl-logo {color: #EB1764;cursor: pointer;font-weight: bold;text-decoration: none} .bl-source{ overflow-x:scroll; background-color: #FFFFFF; border: 1px solid #CBCBCB; color: #363636; margin: 25px 20px; width: 80%;} .bl-source div{white-space: pre;font-family: monospace;} .bl-source span{background-color: #EAEAEA;color: #949494;display: inline-block;padding: 0 10px;text-align: center;width: 30px;} .bl-source .miss{backgr
@orient-man
orient-man / TimeMachine.js
Last active December 13, 2015 21:28
Substitutes built in Date object with our own to support time shifting
/*jslint strict: false */
// beware TOXIC HACK
(function ($) {
// footer contains UpdatePanel with server time
function getApplicationTime() {
var regex = /.*(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2}).*/g,
m = regex.exec($('#ctl00_UpdateLastAsync').text()), i;
for (i = 1; i <= 6; i = i + 1) {
m[i] = parseInt(m[i], 10);