Skip to content

Instantly share code, notes, and snippets.

View pedroreys's full-sized avatar

Pedro Reys pedroreys

View GitHub Profile
. 2010-09-30 17:12:20.636 --------------------------------------------------------------------------
. 2010-09-30 17:12:20.636 WinSCP Version 4.2.9 (Build 938) (OS 6.1.7600)
. 2010-09-30 17:12:20.636 Login time: Thursday, September 30, 2010 5:12:20 PM
. 2010-09-30 17:12:20.637 --------------------------------------------------------------------------
. 2010-09-30 17:12:20.637 Session name:
. 2010-09-30 17:12:20.637 Host name: (Port: 22)
. 2010-09-30 17:12:20.637 User name: (Password: Yes, Key file: No)
. 2010-09-30 17:12:20.638 Tunnel: No
. 2010-09-30 17:12:20.638 Transfer Protocol: SFTP (SCP)
. 2010-09-30 17:12:20.638 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
public class Foo
{
private IContainer _container;
public Foo(IContainer container)
{
_container = container;
}
public Bar()
{
@pedroreys
pedroreys / gist:834651
Created February 19, 2011 00:09
Convention needed when database column datatype is Image
public class ImageLengthConvention : IPropertyConvention, IPropertyConventionAcceptance
{
public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
{
criteria.Expect(x => x.Property.PropertyType == typeof (byte[]));
}
public void Apply(IPropertyInstance instance)
{
instance.Length(2147483647);
[Environment]::SetEnvironmentVariable("PATH",your_path,"Machine")
@pedroreys
pedroreys / certificados, certificados
Created March 15, 2011 20:40
Vai bem a indústria de certificados
1. ANALISTA DE GOVERNANÇA DE TI
Quantidade: 3
Qualificação Técnico-Profissional
Requisitos Obrigatórios:
Possuir curso superior completo;
Possuir ao menos 10 (dez) anos de experiência em TI;
Possuir a certificação ITIL V2 ou V3, nível Foundation;
Possuir a certificação COBIT Foundation.
2. ARQUITETO SOA
@pedroreys
pedroreys / gist:957776
Created May 5, 2011 19:54
Encoraging commit message
"Hack Attack! - Finally got the Tab Ordering working per specs , but it's hacky as heck :( There must be a PhD program offered in handling Winform events and tab ordering somewhere... I may need to enroll in it."
And now I have to fix it. :(
@pedroreys
pedroreys / gist:1097464
Created July 21, 2011 15:43
AutoMapper Example
var contacts = new List<Dto>();
foreach(Employee employee in Employees)
{
Dto contact = new Mapper.Map<Employee, Dto>(employee);
contacts.Add(contact);
}
@pedroreys
pedroreys / gist:1108443
Created July 27, 2011 00:49
Right function in C#
public string Right(string value, int targetLenght)
{
var startIndex = value.Length - targetLenght;
return value.Substring(startIndex, targetLenght);
}
@pedroreys
pedroreys / gist:1108447
Created July 27, 2011 00:55
right linq expression
public Expression Right(string value, int targetLenght)
{
var valueConstant = Expression.Constant(value);
var targetLenghtConstant = Expression.Constant(targetLenght);
var pi = typeof(String).GetProperty("Length");
var mi = typeof(string).GetMethod("Substring", new[] { typeof(int), typeof(int) });
var valueLenght = Expression.Property(valueConstant, pi);
var startIndex = Expression.Subtract(valueLenght, targetLenghtConstant);
var rightExpression = Expression.Call(valueConstant, mi, startIndex, targetLenght);
@pedroreys
pedroreys / gist:1108450
Created July 27, 2011 00:56
Test right linq expression
[Test]
public void Should_evaluate_a_Right_function()
{
var rightExpression = ExpressionBuilder.Right();
Func<string,int,string> right = Expression.Lambda<Func<string,int,string>>(rightExpression).Compile();
right("Some String", 5).ShouldEqual("tring");
}