Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Diego Magalhães dgomesbr

🏠
Working from home
View GitHub Profile
@dgomesbr
dgomesbr / gist:1140687
Created Aug 11, 2011
Zebra Stripe tables :)
View gist:1140687
$(document).ready(function(){
$(".stripeMe tr").on{
mouseover: function()
{
$(this).addClass("over");
}
mouseleave: function()
{
$(this).removeClass("over");
}
@dgomesbr
dgomesbr / ContentHelper.cs
Created Feb 6, 2012
ASP.NET MVC 2 Html.ImageActionLink Helper using Microsoft.Web.Mvc
View ContentHelper.cs
// After using the Microsoft.Web.Mvc Html.ActionLink<TController>(... Expression<Action<TController>> action ...);
// I was unable to use that for a Image, so here's the code for it:
// **** :) no more magic strings for image linking to actions.
// usage:
// <%= Html.ImageActionLink<HomeController>(
// x => x.ChangeCulture(Culture.pt, this.Request.RawUrl),
// Culture.pt.ToString() + ".png")
// %>
@dgomesbr
dgomesbr / NHibernateHttpModule.cs
Created Feb 9, 2012
NHibernateHttpModule.cs depois do resharper
View NHibernateHttpModule.cs
using System;
using System.Web;
using NHibernate;
using NHibernate.Cfg;
namespace workshop_httpmodule
{
public class NHibernateHttpModule : IHttpModule
{
public static readonly string NHibernateSessionKey = "NHibernateSession";
@dgomesbr
dgomesbr / Category.cs
Created Feb 9, 2012
Mapeamento da classe Categoria no NHibernate 3.2
View Category.cs
using NHibernate.Driver;
using NHibernate.Mapping.ByCode;
using NHibernate.Mapping.ByCode.Conformist;
namespace workshop_Entity
{
public class Category
{
public virtual int IdCategoria { get; set; }
public virtual string Nome { get; set; }
@dgomesbr
dgomesbr / IRepository.cs
Created Feb 9, 2012
Interface para repositório genérico
View IRepository.cs
using System.Collections.Generic;
namespace Workshop.Data
{
public interface IRepository<T>
{
T Save(T entity);
T Update(T entity);
void Delete(T entity);
T ById(int id);
@dgomesbr
dgomesbr / GenericRepository.cs
Created Feb 9, 2012
Implementação do repositório genérico
View GenericRepository.cs
using System.Collections.Generic;
using workshop_httpmodule;
namespace Workshop.Data.NHibernate
{
public class GenericRepository<T> : IRepository<T>
{
public T Save(T entity)
{
NHibernateHttpModule.RecuperarSessao.Save(entity);
@dgomesbr
dgomesbr / gist:1882968
Created Feb 22, 2012
StructureMap Fooooo
View gist:1882968
For<IRepository<TipoServico>>().Use<Repository<TipoServico>>();
@dgomesbr
dgomesbr / SpringConfig.java
Created Oct 9, 2012
Spring 3.1 Configurable Class :)
View SpringConfig.java
package com.bemobi.wap.config;
import java.util.Properties;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.hibernate.ejb.HibernatePersistence;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
View UserRequiredAnnotationInterceptor.java
public class UserRequiredAnnotationInterceptor extends HandlerInterceptorAdapter
{
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
{
if (handler == null)
{
return true;
}
View UserRequiredAnnotationInterceptor.java
public class UserRequiredAnnotationInterceptor extends HandlerInterceptorAdapter
{
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception
{
if (handler == null)
{
return true;
}
You can’t perform that action at this time.