Skip to content

Instantly share code, notes, and snippets.

View andreabalducci's full-sized avatar

Andrea Balducci andreabalducci

View GitHub Profile
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.Core.Logging;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
namespace Lucilla.Framework.Core.Data
<div class="field-row">
<div class="field-box">
<%=Html.AutoCompleteFor(
x => x.Customer.CompanyName,
x => x.Customer.Id,
Url.Action("Autocomplete", "Customer")
) %><br />
</div>
</div>
@andreabalducci
andreabalducci / Global.asax.cs
Created January 10, 2011 22:36
Uppercase and Lowercase ModelBinder attributes for Asp.Net MVC2
...
protected void Application_Start()
{
...
// todo: add windsor + autodiscovery by convention
ModelMetadataProviders.Current = new LucillaMetadataProvider();
ModelBinders.Binders.DefaultBinder = new LucillaModelBinder();
...
}
...
@andreabalducci
andreabalducci / LucillaHybridSessionStore.cs
Created January 11, 2011 22:23
Hybrid Session store for Castle.Facilities.NHibernateIntegration (httpcontext + fallback on callcontext)
using System;
using System.Collections;
using System.Runtime.Remoting.Messaging;
using System.Web;
using Castle.Facilities.NHibernateIntegration.SessionStores;
namespace Lucilla.Framework.Core.Data.NHFacility
{
internal interface ISessionStoreContextAdapter
{
@andreabalducci
andreabalducci / OperatorTest.cpp
Created June 17, 2011 08:20
Testing assignment operator override
// OperatorTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <conio.h>
class Base
{
public:
int _value;
@andreabalducci
andreabalducci / MonitorTests.cs
Created July 5, 2011 21:05
First Attempt to create a Dynamic Object with Thread Safe support (and first time dynamic too ;D)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using NUnit.Framework;
using Prxm.ManPack.Monitor;
using SharpTestsEx;
namespace Prxm.ManPack.ServicesTests.MonitorTests
@andreabalducci
andreabalducci / WinJSAdapter.js
Created May 29, 2012 14:21
winjs update context wrapper
(function (){
var UpdateContext = window.UpdateContext = window.UpdateContext || {};
var isWinJS = typeof(MSApp) != 'undefined';
if(isWinJS){
UpdateContext.Execute = function(cb){
MSApp.execUnsafeLocalFunction(cb);
};
}else{
@andreabalducci
andreabalducci / expectAsync.js
Created August 6, 2012 13:49
expectAsync extension for jasmine
var CALL_TIMEOUT = 4000;
function expectAsync(promise, expectations) {
var completed = false;
runs(function () {
promise.call().always(function () {
completed = true;
})
});
// From http://baagoe.com/en/RandomMusings/javascript/
function Alea() {
return (function(args) {
// Johannes Baagøe <baagoe@baagoe.com>, 2010
var s0 = 0;
var s1 = 0;
var s2 = 0;
var c = 1;
if (args.length == 0) {
@andreabalducci
andreabalducci / fasterflect_test.cs
Created September 6, 2012 09:25
Fasterflect performance test
[Test, Explicit]
public void fasterflect_performance_test()
{
var handler = new SampleEventHandler();
var @event = new SampleEvent();
int iterations = 10000000;
// fasterflect
{
handler.Counter = 0;