Skip to content

Instantly share code, notes, and snippets.

View andreazevedo's full-sized avatar

Andre Azevedo Pinto andreazevedo

  • Google
  • Mountain View, CA
View GitHub Profile
@andreazevedo
andreazevedo / numbers.scala
Created September 25, 2012 17:57 — forked from mateusfreira/gist:3781896
Dado um vetor com 'n' números distintos, calcular quantas possibilidades existem para se obter a soma 's'
def countSum(numbers: List[Int], expectedResult: Int): Int = {
countSumRecursively(numbers, 0, expectedResult);
}
def countSumRecursively(numbers: List[Int], currentResult: Int, expectedResult: Int): Int = {
if (currentResult == expectedResult)
1
else if ((currentResult > expectedResult) || (numbers.isEmpty))
0
else
@andreazevedo
andreazevedo / nhrollback.cs
Created September 20, 2012 20:48 — forked from lukemcgregor/nhrollback
Do NHibernate Transactions rollback with parent transaction scope?
using System;
using System.Data.SqlServerCe;
using System.IO;
using System.Reflection;
using Moq;
using NHibernate;
using NHibernate.ByteCode.Castle;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;