Skip to content

Instantly share code, notes, and snippets.

View alexandreaquiles's full-sized avatar

Alexandre Aquiles alexandreaquiles

View GitHub Profile
@rponte
rponte / StringUtils.java
Last active April 10, 2024 23:01
Removing accents and special characters in Java: StringUtils.java and StringUtilsTest.java
package br.com.triadworks.rponte.util;
import java.text.Normalizer;
public class StringUtils {
/**
* Remove toda a acentuação da string substituindo por caracteres simples sem acento.
*/
public static String unaccent(String src) {
@rponte
rponte / macrodef-sample.xml
Created May 18, 2011 18:19
ant macrodef sample
<!-- Create migrate task -->
<macrodef name="migrate">
<attribute name="command" />
<attribute name="environment" />
<element name="extraarguments" optional="true" />
<sequential>
<echo>** Executing "migrate @{command}" on "@{environment}" environment **</echo>
<java classname="org.apache.ibatis.migration.Migrator"
failonerror="true" fork="true" classpathref="classpath">
<sysproperty key="file.encoding" value="UTF-8"/>
@ingorichter
ingorichter / listAllProjectsWithPerforceSCM.groovy
Created July 26, 2011 05:45
groovy cli script to display all jobs with a perforce scm configuration
def jobs = hudson.model.Hudson.instance.items
jobs.each { job ->
def scm = job.scm
if (scm.class.name == 'hudson.plugins.perforce.PerforceSCM') {
println "Job '${job.name}' uses the following perforce configuration"
println '-' * 80
println "P4Port: ${scm.getP4Port()}"
println "P4Client: ${scm.getP4Client()}"
println "P4User: ${scm.getP4User()}"
@klauswuestefeld
klauswuestefeld / gist:1595701
Created January 11, 2012 17:22
O Ciclo Vicioso Do Software Retranqueiro
We couldn’t find that file to show.
@ldaniel
ldaniel / _aviso.md
Created May 16, 2012 12:18
Crítica à comunidade .NET

Aviso importante

"Às vezes, um charuto é apenas um charuto."

Não almejamos mais seguidores no Twitter, leitores para o blog ou amigos no Facebook. Somos, assumidamente (e com discreto orgulho), pessoas pouco sociáveis. Sim, esta crítica é, nesse caso, apenas uma crítica.

@leandronet e @mantov

@jezen
jezen / Io Example Problems
Created December 15, 2013 13:17
The example problems have gone missing from the Io language website, so here’s a backup.
#Sample code
#Hello world
"Hello world!" print
#Factorial
factorial := method(n, if(n == 1, 1, n * factorial(n - 1)))
99 bottles of beer
@miguelmota
miguelmota / start_stream.sh
Last active August 11, 2021 17:16
MJPG-Streamer start and stop bash scripts. For 19 Jan 2014 Update - blog post: http://www.miguelmota.com/blog/raspberry-pi-camera-board-video-streaming/
#!/bin/bash
if pgrep mjpg_streamer > /dev/null
then
echo "mjpg_streamer already running"
else
LD_LIBRARY_PATH=/opt/mjpg-streamer/ /opt/mjpg-streamer/mjpg_streamer -i "input_raspicam.so -fps 15 -q 50 -x 640 -y 480" -o "output_http.so -p 9000 -w /opt/mjpg-streamer/www" > /dev/null 2>&1&
echo "mjpg_streamer started"
fi
@benoitx
benoitx / Date Calc using JDK8 LocalDate.java
Created May 26, 2014 08:48
Date Calc using JDK8 LocalDate
// create or get the Holidays
final Set<LocalDate> holidays = new HashSet<LocalDate>();
holidays.add(LocalDate.parse("2006-08-28"));
//... keep adding all holidays for 2006
// create the HolidayCalendar ASSUMING that the set covers 2006!
final HolidayCalendar<LocalDate> calendar = new DefaultHolidayCalendar<LocalDate>
(holidays, LocalDate.parse("2006-01-01"), LocalDate.parse("2006-12-31"));
// register the holidays, any calculator with name "UK"
@rcaneppele
rcaneppele / JdbcTarefaDao.java
Created May 29, 2014 16:29
FJ21-Tarefas - Multiplos Datasources
@Repository
public class JdbcTarefaDao
private Connection connection;
@Autowired
@Qualifier("postgreDataSource")
private DataSource dataSource;
@PostConstruct
@rcaneppele
rcaneppele / TarefasController.java
Created May 29, 2014 21:23
FJ21-Tarefas - Bootstrap
package br.com.caelum.tarefas.controller;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;