Skip to content

Instantly share code, notes, and snippets.

@victorkendy
victorkendy / README.md
Last active May 26, 2017 14:28
Notas OTP

gen_server -> RPC

-module(teste_server).
-behaviour(gen_server).

-export([start_link/0]).
-export([init/1, handle_call/3, handle_cast/2]).

start_link() ->
@victorkendy
victorkendy / PasswordForteAttribute.cs
Created July 8, 2014 17:48
Validação customizada utilizando o Asp.Net MVC
public class PasswordForteAttribute : ValidationAttribute, IClientValidatable
{
private readonly static String PasswordPattern = @"((?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{4,100})";
private readonly static Regex PasswordRegex = new Regex(PasswordPattern);
public PasswordForteAttribute() : base("Senha muito fraca") { }
public override bool IsValid(object value)
{
String password = value.ToString();
@victorkendy
victorkendy / Attrs.cs
Created April 25, 2012 14:44
Implementação da interface IControllerFactory usando o Unity Container e registro automático de controllers e dependências
using System;
namespace CustomFactory.Attrs
{
public class ComponentAttribute : Attribute
{
}
}
@victorkendy
victorkendy / list.py
Created March 28, 2012 00:19
exemplos de mônadas em python
class List(object):
@staticmethod
def unit(a):
return List([a])
def __init__(self, l):
self.l = l
def _lazy_result_list(self, f):
# faz o map
# item: List