Skip to content

Instantly share code, notes, and snippets.

View sierisimo's full-sized avatar
🦕

Sinuhe Jaime sierisimo

🦕
View GitHub Profile

Testing… is not that hard

From time to time we need to talk about this topic. Most of us are familiar with it and we feel comfortable with writing tests, but the truth is that doing so is not a particularly popular topic.

In the past years, the tendency has been using some variant of cool techniques like TDD and BDD, and they are well applied; but most developers don't follow the rules or feel like the deadlines don't allow them to just write unit or integration tests. Geez… I even have heard some people say: "[sic] writing test is for QA teams right?"

Well… this is my attempt to show that testing is not that hard and can be an easy part of your daily workflow.

Notes:

@sierisimo
sierisimo / build-diagrams.sh
Last active January 31, 2019 06:12
A small shell script that I wrote to download the plantuml jar and convert iuml files in a directory to svg or png
#! /usr/bin/env bash
PLANTUML_EXECUTABLE="plantuml.jar"
PLANTUML_URL="http://sourceforge.net/projects/plantuml/files/plantuml.jar/download"
function usage {
printf "Usage: $0 [-h] [-f <FORMAT>]\n\\ntWhere <FORMAT> can be:\n\t\tpng,svg" 1>&2
exit 1
}
@sierisimo
sierisimo / MainActivity.kt
Last active December 14, 2018 01:02
Common mistake when running espresso
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}
@sierisimo
sierisimo / CustomPluginWithTask.kt
Last active November 9, 2018 22:30
Simplest Gradle Task
open class CustomPluginWithTask : Plugin<Project> {
override fun apply(project: Project) {
project.tasks.create("myCustomTask") { task ->
task.group = "My Group"
task.description = "A simple task example"
println("Hello, I'm your plugin")
}
}
}
@sierisimo
sierisimo / LaunchActivity.kt
Last active May 23, 2019 06:07
Single function to launch an activity with a simple function and allow the inline build of the extras #kotlin #android
inline fun <reified T : Activity> Context.launchActivity(intentBlock: Intent.() -> Unit = {}) {
val intent = Intent(this, T::class.java)
intent.intentBlock()
startActivity(intent)
}
@sierisimo
sierisimo / babyada.adb
Created February 14, 2017 04:43
Hello world, from my baby Ada
with Ada.Text_IO;
use Ada.Text_IO;
procedure BabyAda is
begin
Put_Line ("Hello World, my name is Ada Victoria Jaime Reyes!");
end BabyAda;

Keybase proof

I hereby claim:

  • I am sierisimo on github.
  • I am sierisimo (https://keybase.io/sierisimo) on keybase.
  • I have a public key ASCoMnYCnni0rKN3cKTPM5oGpzqSMApvgyXjjySTlR0InAo

To claim this, I am signing this object:

@sierisimo
sierisimo / GetEmail.java
Created February 14, 2016 07:49
Get Email from Android Phone < 6.0
if(userEmail == null || userEmail.trim().isEmpty()) {
boolean flag = false;
Pattern emailPattern = Patterns.EMAIL_ADDRESS; // API level 8+
Account[] accounts = AccountManager.get(LoginActivity.this).getAccounts();
for (Account account : accounts) {
if (emailPattern.matcher(account.name).matches()) {
@sierisimo
sierisimo / HeaderAdapter.java
Last active April 21, 2016 04:35 — forked from ec84b4/gist:d56c00fb5fd2dfaf279b
Adapater for RecyclerView with headers between items
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
/**
* Created by khaled bakhtiari on 10/26/2014.
* <a href="http://about.me/kh.bakhtiari">
*/