Skip to content

Instantly share code, notes, and snippets.

@hvitorino
hvitorino / Singleton
Created June 6, 2011 18:22
Singleton C#
public sealed class Singleton {
private static Singleton instance;
static Singleton() {
instance = new Singleton();
}
public Singleton Instance {
get { return instance; }
}
@hvitorino
hvitorino / bb
Created June 11, 2011 11:02
tratamento de exceções do bb
[Exception in:/outrasOpcoes/841e3.jsp] null java.lang.NullPointerException at
jsp_servlet._outrasopcoes.__841e3._jspService(__841e3.java:224) at
weblogic.servlet.jsp.JspBase.service(JspBase.java:34) at
weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at
weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300) at
weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183) at
weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:526) at
weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:447) at
weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:163) at
@hvitorino
hvitorino / Mapas
Created August 5, 2011 20:31
Resolvendo implementação dos mapas
var todos = Assembly.GetExecutingAssembly().GetTypes();
var implemetacoes = todos.Where(
impl =>
impl
.GetInterfaces()
.Where(i => i.Name.StartsWith("IMapa")).Count() == 1);
implemetacoes.SelectMany(x => x.GetInterfaces()).ToList()
.ForEach(i => container.Resolve(i));
@hvitorino
hvitorino / qconsp
Created August 31, 2011 10:22
qconsp
REST e o Cloud: feitos um para o outro?
http://qconsp.com/palestra/howard-dierking/rest-e-o-cloud-feitos-um-para-o-outro
Levando .net onde você jamais imaginou
http://qconsp.com/palestra/rodrigo-kumpera/levando-net-onde-voce-jamais-imaginou
Entendendo sistemas distribuídos - CAP é só o começo!
http://qconsp.com/palestra/john-rowell/entendendo-sistemas-distribuidos-cap-e-so-o-comeco
Combinando Programação funcional e O.O. em javascript de forma prática
@hvitorino
hvitorino / loop
Created October 8, 2011 01:37
loop
Dentro da caixa
8 = 8
Fora da caixa
8 = 2*2*2
8 = 2^3
8 = S(S(S(S(S(S(S(1)))))))
...
@hvitorino
hvitorino / gittimeline
Created October 10, 2011 21:38
git timeline
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
@hvitorino
hvitorino / sammyjs
Created October 12, 2011 18:12
sammyjs
//Rota no Sammy
this.get('#/evento/criar', Views.Evento.Criacao.Inicializa);
// Arquivo da View
;(function() {
if(!Views.Evento)
Views.Evento = { };
Views.Evento.Criacao = function (ctx) {
var self = this;
@hvitorino
hvitorino / controllerinstaller
Created October 17, 2011 20:36
controller installer - windsor
public class ControllersInstaller : IWindsorInstaller
{
#region IWindsorInstaller Members
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.Register(FindControllers().Configure(ConfigureControllers()));
}
#endregion
@hvitorino
hvitorino / jqueryplugin
Created October 18, 2011 10:23
jquery plugin
(function ($) {
$.fn.carregaOptions = function(configs) {
var defaults = {
options : [],
template: function(val) {
return '<option value="{0}">{1}</option>'.format(val[0], val[1]);
}
};
return this.each(function(val) {
@hvitorino
hvitorino / fluentnh conventions
Created October 24, 2011 13:53
Convenções de mapeamento para FluentNH
using FluentNHibernate.Conventions;
using FluentNHibernate.Conventions.Helpers;
namespace Aramis.Persistencia.Configuracao
{
public class AramisConventions
{
public static AramisConventions Recupera
{
get { return new AramisConventions(); }