Skip to content

Instantly share code, notes, and snippets.

View pablomoretti's full-sized avatar

Pablo Moretti pablomoretti

  • MercadoLibre
  • Argentina
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<link href="http://udacity-crp.herokuapp.com/style.css?rtt=1" rel="stylesheet">
</head>
<body>
<span></span>
@pablomoretti
pablomoretti / gist:9748230
Created March 24, 2014 20:17
SimpleDateFormatThreadSafe
package com.foocoders.text;
import java.text.AttributedCharacterIterator;
import java.text.DateFormatSymbols;
import java.text.FieldPosition;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
@pablomoretti
pablomoretti / LockByName
Created December 22, 2013 20:54
Get lock by name using java.util.concurrent
package com.mercadolibre.concurrent;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantLock;
public class LockByName<L> {
ConcurrentHashMap<String, L> mapStringLock;
public LockByName(){
package buflo.util
import org.apache.commons.lang.time.FastDateFormat;
//import org.joda.time.format.ISO8601DateFormat;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.format.ISODateTimeFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
package net.spy.memcached.utils;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import net.spy.memcached.MemcachedClient;
import org.springframework.beans.factory.FactoryBean;
public class MemcachedClientFactoryBean implements FactoryBean<MemcachedClient> {
@pablomoretti
pablomoretti / get-item.php
Created October 17, 2011 03:03
MercadoLibre - GET ITEM - EXAMPLE PHP
<?php
header('Content-Type: text/html; charset=utf-8');
// we recommend use most robust http client.
// http://www.google.com/search?q=http+client+php
function http_client_get($url) {
//busco el contenido un archivo por si lo habia guardado anteriormente
$reponse = unserialize(@file_get_contents(sys_get_temp_dir() . "/cache_http_client_get-" . str_replace("/", ".",$url)));