Skip to content

Instantly share code, notes, and snippets.

View fabiorecife's full-sized avatar

Fábio Almeida fabiorecife

  • Recife , PE , Brasil
View GitHub Profile
@fabiorecife
fabiorecife / RestletRouterTest.java
Created October 8, 2011 16:43
how to test a Router restlet
package net.fabioalmeida.test.router;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.restlet.Context;
import org.restlet.Request;
import org.restlet.Response;
import org.restlet.Restlet;
@fabiorecife
fabiorecife / gist:1276145
Created October 10, 2011 18:44
Load a file line by line
File file = new File("./src_teste/JsonFromXmlAjaxResponseTest01.xml");
BufferedReader buf = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
String line ;
StringBuilder build = new StringBuilder();
while ((line = buf.readLine()) != null) {
build.append(line);
}
@fabiorecife
fabiorecife / gist:1305878
Created October 22, 2011 11:05
rename files .ogg.mp3 to mp3
for name in *.mp3; do mv "$name" "$(basename "$name" .ogg.mp3).mp3"; done;
@fabiorecife
fabiorecife / gist:1305881
Created October 22, 2011 11:08
replace all expression in string
string.replaceAll("\\$\\{name\\}", stringValue);
@fabiorecife
fabiorecife / gist:1360775
Created November 12, 2011 16:29
Selenium com GWT - exemplo simples
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://127.0.0.1:8888/" />
<title>selenium_test_bom</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
@fabiorecife
fabiorecife / module_gwt.xml
Created December 16, 2011 18:19
GWT em português
<module>
...
<inherits name="com.google.gwt.i18n.I18N"/>
<extend-property name="locale" values="pt_BR"/>
<set-property-fallback name="locale" value="pt_BR"/>
...
</module>
@fabiorecife
fabiorecife / gist:1961759
Created March 2, 2012 22:14
String reverse
"edcb//:ptth".split("").reverse().join("")
@fabiorecife
fabiorecife / catpdf.bat
Created March 26, 2012 01:41
MS DOS - merge multiple pdfs
@ECHO OFF
FOR /D %%A IN (*) DO (
ECHO PROCESSANDO %%A
cd "%%A"
..\pdftk *.pdf cat output "%%A".pdf
ECHO FIM DO PROCESSAMENTO
cd ..
)
@fabiorecife
fabiorecife / sendMailGoogleAppsScript
Created April 11, 2012 14:17
send mail with google apps script
function sendMailAvaliacaoFicha() {
var sheet = SpreadsheetApp.getActiveSheet();
var startRow = 2; // First row of data to process
var numRows = 9; // Number of rows to process
// Fetch the range of cells A2:F10
var dataRange = sheet.getRange(startRow, 1, numRows, 6)
// Fetch values for each row in the Range.
var data = dataRange.getValues();
for (i in data) {
var row = data[i];
@fabiorecife
fabiorecife / pom.xml
Created June 7, 2012 20:46
maven dependency list of restlet
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.fabioalmeida.htmllist</groupId>
<artifactId>htmllist</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>htmllist</name>