Skip to content

Instantly share code, notes, and snippets.

💭
Paternity leave, see y'all in June.

Diego Magalhães dgomesbr

💭
Paternity leave, see y'all in June.
Block or report user

Report or block dgomesbr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dgomesbr
dgomesbr / patch.4.0.php
Last active Aug 29, 2015
Patch for domain defined in user properties.
View patch.4.0.php
if(!$user = $this->db->get("user",array("api"=>"?"),array("limit"=>1),array($key))) return $this->api_build(array("error"=>1,"msg"=>"A valid API key is required to use this service."));
$this->userid = $user->id;
$this->customDomain = $user->domain;
// Check Request type
if(!isset($_GET["url"]) && !isset($_GET["short"])) return $this->api_build(array("error"=>1,"msg"=>"Please enter a valid URL."));
// Check if shorten request is made
if(isset($_GET["url"])){
$array = array();
@dgomesbr
dgomesbr / ConcurrentChunkProcessor.java
Last active Aug 29, 2015
Example of parallel processing on ConcurrentChunkProcessor
View ConcurrentChunkProcessor.java
/**
* same as SimpleChunkProcessor except otherwise shown
*/
public class ConcurrentChunkProcessor<I, O> implements ChunkProcessor<I>, InitializingBean {
// ...
// example of parallel processing using Executor service, better create this by Spring and inject if available or
// use the same TaskExecutor from the Context
private static final int THREADPOOL_TIMEOUT_IN_SECONDS = 1;
View sample.q
DROP TABLE REVIVE_AD_VIS;
CREATE EXTERNAL TABLE REVIVE_AD_VIS ( hour String, bannerid STRING, campaignid STRING, zoneid STRING, count STRING )
row format
delimited fields terminated by ','
lines terminated by '\n'
STORED
AS TEXTFILE LOCATION 's3n://EMRresult/OutputFolder';
INSERT OVERWRITE TABLE REVIVE_AD_VIS
SELECT
@dgomesbr
dgomesbr / error.log
Last active Aug 29, 2015
Docker Zipkin start error
View error.log
osboxes deploy # ./deploy.sh
** Starting zipkin-cassandra
9fc184535addcaaaa55de0df11241c3e9c806c174986ef8142e4282f12198367
** Starting zipkin-collector
ad7ac5b12f80463044b65e75b88fe36e245c98dacc0c9b46eeeee3310061d480
2015/03/24 05:48:01 Error response from daemon: Cannot start container ad7ac5b12f80463044b65e75b88fe36e245c98dacc0c9b46eeeee3310061d480: Cannot link to a non running container: /zipkin-cassandra AS /zipkin-collector/db
** Starting zipkin-query
2ff7e1cb21a7198685be229a84f242a59028e11363cf2d8853bbe821075f08bd
2015/03/24 05:48:03 Error response from daemon: Cannot start container 2ff7e1cb21a7198685be229a84f242a59028e11363cf2d8853bbe821075f08bd: Cannot link to a non running container: /zipkin-cassandra AS /zipkin-query/db
** Starting zipkin-web
View microservices.adoc

Service Design - Bemobi

Sample Dataset

This sample dataset is a representation of Bemobi

@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 / 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 / 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";
You can’t perform that action at this time.