View basic-pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
~ Licensed under the Apache License, Version 2.0 (the "License"); | |
~ you may not use this file except in compliance with the License. | |
~ You may obtain a copy of the License at | |
~ | |
~ http://www.apache.org/licenses/LICENSE-2.0 | |
~ | |
~ Unless required by applicable law or agreed to in writing, software | |
~ distributed under the License is distributed on an "AS IS" BASIS, |
View StringUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.Normalizer | |
object StringUtil { | |
fun slugify(word: String, replacement: String = "-") = Normalizer | |
.normalize(word, Normalizer.Form.NFD) | |
.replace("[^\\p{ASCII}]".toRegex(), "") | |
.replace("[^a-zA-Z0-9\\s]+".toRegex(), "").trim() | |
.replace("\\s+".toRegex(), replacement) | |
.toLowerCase() |
View BarcodeUtilsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.Test; | |
import java.util.Calendar; | |
import java.util.Date; | |
import java.util.GregorianCalendar; | |
import static junit.framework.TestCase.*; | |
public class BarcodeUtilsTest { |
View git-refresh.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
GITROOT="${1:-.}" | |
find $GITROOT -name .git -type d | cat -n | while read n f | |
do | |
cd "$(dirname "$f")" | |
GITDEFBR="$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')" | |
GITPROJ="$(pwd -P)" | |
echo "\033[32m>>> \033[1m$GITPROJ\033[0m\033[21m" | |
GITBRANCH=$(git rev-parse --abbrev-ref HEAD) | |
git add . |
View QRCodeUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.graphics.Bitmap; | |
import android.graphics.Color; | |
import com.google.zxing.BarcodeFormat; | |
import com.google.zxing.MultiFormatWriter; | |
import com.google.zxing.WriterException; | |
import com.google.zxing.common.BitMatrix; | |
public class QRCodeUtil { |
View BarcodeUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Calendar; | |
import java.util.Date; | |
import java.util.GregorianCalendar; | |
/** | |
* This class validate a barcode and convert it to "Linha Digitável". | |
* | |
* @author adriano | |
* @since Set 25, 2014 |
View DocumentUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DocumentUtil { | |
// CPF | |
private static final int[] WEIGHT_SSN = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2}; | |
// CNPJ | |
private static final int[] WEIGHT_TFN = {6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2}; | |
private static int sum(int[] weight, char[] numbers, int length) { | |
if (length <= 0) return 0; |