Skip to content

Instantly share code, notes, and snippets.

View Pierry's full-sized avatar
🎯
Focusing

Pierry Borges Pierry

🎯
Focusing
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="green">#1abc9c</color>
<color name="light_green">#2ecc71</color>
<color name="blue">#3498db</color>
<color name="deep_purple">#9b59b6</color>
<color name="dark_grey">#34495e</color>
<color name="deep_green">#27ae60</color>
<color name="deep_blue">#2980b9</color>
<color name="yellow">#f1c40f</color>
@Pierry
Pierry / UnityResolver.cs
Created January 13, 2015 13:08
Unity - Web API DI
// Install-Package Unity
public class UnityResolver : IDependencyResolver
{
protected IUnityContainer Container;
public UnityResolver(IUnityContainer container)
{
if (container == null)
{
throw new ArgumentNullException("container");
@Pierry
Pierry / tdd
Created February 7, 2015 02:54
tdd, di, mocks
To do TDD in Android, I personally use all of the following:
FEST-android: FEST assertions for Android
Mockito: Mocking Framework
Robolectric: Unit testing framework that runs without the need of Android emulator
Robotium: UI tests (Needs emulator or device to run)
Also: Using dependency injection libraries such as Dagger or Roboguice will greatly simplify your unit/integration tests. To run tests on multiple devices, consider using Spoon.
@Pierry
Pierry / addcliente
Last active August 29, 2015 14:15
JR REST - Adicionar Cliente - Exemplo
{
"Codigo": "22123222000222", // CNPJ ou CPF sem pontos ou traços
"Nome": "MEU CLIENTE LTDA ME", // Razão social
"Fantasia": "Meu Cliente", // Fantasia
"Endereco": "Rua 22",
"NumEnder": 22, // Numero
"Complemento": "Casa",
"Bairro": "Centro",
"Cidade": "Itapmea",
"Uf": "SC",
@Pierry
Pierry / addpedido
Last active August 29, 2015 14:15
JR REST - Adicionar Pedido - Exemplo
{
"ClienteId": "0000000000001000",
"DataAbertura": "2015-02-19",
"VendedorId": 1,
"Produtos": [
{
"Codigo":"0000000000642",
"Descricao": "LICENÇA USO SOFTWARE( VINCULADO A MENSALIDADE)",
"Unitario": 2.00,
"Total": 4.00,
@Pierry
Pierry / android-imageview-load.java
Created February 20, 2015 17:05
image-load-from-path-android
// get download directory
File imgFile = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
if(imgFile.exists()) {
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getPath() + "/ovo.jpg");
ivImagem.setImageBitmap(myBitmap);
}
}
@Pierry
Pierry / WebApiConfig.cs
Created February 23, 2015 19:04
formatter-json - WebApiConfig
// Remove o XML
var formatters = config.Formatters;
formatters.Remove(formatters.XmlFormatter);
// Modifica a identação
var jsonSettings = formatters.JsonFormatter.SerializerSettings;
jsonSettings.Formatting = Formatting.Indented;
jsonSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
// Modifica a serialização
@Pierry
Pierry / AssertionConcern.java
Last active August 29, 2015 14:16
AssertionConcern Java
public class AssertionConcern {
public static void AssertArgumentEquals(Object object1, Object object2, String message) throws InvalidObjectException
{
if (!object1.equals(object2)) {
throw new InvalidObjectException(message);
}
}
public static void AssertArgumentFalse(boolean boolValue, String message) throws InvalidObjectException
@Pierry
Pierry / connection
Created April 6, 2015 20:13
connection string mysql
<connectionStrings>
<add name="DatabaseConnectionString" connectionString="server=MEUSERVER;user id=MEUUSER;password=MEUPASS;persistsecurityinfo=True;database=gsn" providerName="MySql.Data.MySqlClient" />
</connectionStrings>
@Pierry
Pierry / appbuild.gradle
Created April 29, 2015 13:17
JitPack config
buildscript {
repositories {
}
dependencies {
}
}
repositories {
maven {
url "https://jitpack.io"