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 / install_mono.sh
Last active November 12, 2021 02:51
Install mono on centOS 6.x
$ yum install bison gettext glib2 freetype fontconfig libpng libpng-devel libX11 libX11-devel glib2-devel libgdi* libexif glibc-devel urw-fonts java unzip gcc gcc-c++ automake autoconf libtool make bzip2 wget
$ cd /usr/local/src
$ wget http://download.mono-project.com/sources/mono/mono-3.2.8.tar.bz2
$ tar jxf mono-3.2.8.tar.bz2
$ cd mono-3.2.8
@andreazevedo
andreazevedo / class_definition.js
Created March 12, 2013 15:19
Good pattern for defining javascript classes.
/** Class Foo **/
var Foo = (function () {
// Private variables
var private_number = 200
/** class Constructor **/
var Foo = function () {
this.bar = 0;
};
/** class methods **/
Foo.prototype = {
@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;
@andreazevedo
andreazevedo / NaN.htm
Created August 16, 2011 02:05
Odd NaN feature in JavaScript
<html>
<head>
<script>
function printLine(content) {
if (content) {
document.body.innerHTML += content;
}
document.body.innerHTML += "<br/>";
}
@andreazevedo
andreazevedo / octalNumbers.html
Created August 12, 2011 18:39
JavaScript: octal numbers and strict mode.
<html>
<head>
<script>
function printLine(content) {
if (content != null) {
document.body.innerHTML += content;
}
document.body.innerHTML += "<br/>";
}