Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonatas Emidio jonatasemidio

View GitHub Profile
@jonatasemidio
jonatasemidio / JVM
Created May 8, 2014
JVM: Variáveis de memória para evitar erro de PermGem no IntelliJ
View JVM
-Xms740m -Xmx1024m -XX:MaxPermSize=512m
@jonatasemidio
jonatasemidio / InsertColumn.groovy
Created May 22, 2014
Inserção de Coluna em tempo de execução
View InsertColumn.groovy
o = [[id: 1, nome: 'jose'], [id: 2, nome: 'maria']]
o.collect{ it << [idade: 10*it.id] }
println o
View RecursiveMap.java
class RecursiveMap{
public static TreeMap<String, String> routeCalculation (Map<String, TreeMap<String, Integer>> cityMaps, TreeMap<String, String> rota) {
//Map<String, ArrayList<String>> mapping = TrainsInformation.drawAllRoutes(cityMaps);
String originCity = rota.get("ORIGIN_CITY" );
String destinationCity = rota.get("DESTINATION_CITY");
String distance = rota.get("DISTANCE" );
String max = rota.get("MAX" );
String routeMapping = rota.get("ROUTE_MAPPING" );
Integer parsedDistance = Integer.parseInt(distance);
View appanginesample.py
from google.appengine.api import users
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
from google.appengine.ext.webapp import template
from google.appengine.api import memcache
# Set the debug level
_DEBUG = True
@jonatasemidio
jonatasemidio / GParsUrlConcurrentlyProcess.groovy
Created Jul 9, 2014
Find in all selected pages the described expression in parallel
View GParsUrlConcurrentlyProcess.groovy
import static groovyx.gpars.GParsPool.withPool
def urls = [
'http://groovy.codehaus.org',
'http://gpars.codehaus.org',
'http://gr8conf.org/'
]*.toURL()
println withPool {
urls.collectParallel {
@jonatasemidio
jonatasemidio / Bind.groovy
Last active Aug 29, 2015
Bind properties in Services
View Bind.groovy
import org.codehaus.groovy.runtime.InvokerHelper
class A { String nome; Integer idade }
class B { String nome; Integer idade }
class C { String nome; Integer idade }
A a = new A()
B b = new B(nome:'jose', idade: 10)
C c = new C(nome:'bira', idade: 99)
@jonatasemidio
jonatasemidio / UrlProcessor.java
Created Nov 1, 2014
OBS: Código testaro na versão Javac 1.7.0_09
View UrlProcessor.java
class UrlProcessor{
public void detalhamentoUrl(String site){
try{
if(site.substring(0, 3).equals("htt")){
java.net.URL url = new java.net.URL(site);
String path = url.toURI().getPath().substring(1, url.getPath().length());
System.out.println("protocolo: "+url.getProtocol());
System.out.println("host: "+url.getHost().substring(0,3));
View Celular.java
import java.util.Map;
import java.util.HashMap;
public class Celular{
public String traduzCaracter(String frase, int posicao){
Map<String, String> dic = new HashMap<String, String>();
dic.put("A", "2");
dic.put("B", "22");
dic.put("C", "222");
dic.put("D", "3");
View postjs
function post_to_url(url, params) {
var form = document.createElement('form');
form.action = url;
form.method = 'POST';
for (var i in params) {
if (params.hasOwnProperty(i)) {
var input = document.createElement('input');
input.type = 'hidden';
input.name = i;
@jonatasemidio
jonatasemidio / ConversorContrato.groovy
Last active Aug 29, 2015
ConversorTipoBDToJava.groovy
View ConversorContrato.groovy
arquivos =
[
[
bloco:'1#Dados Origem do Tipo Informação = 1 (Contrato)',
detalhes:[
'Tipo Registro | Num | 1 | Identifica o tipo do registro: 0 = Header 1 = Detalhe 9 = Trailer',
'Elemento | Char | 4 | Sigla do elemento (centro de custo) ',