Skip to content

Instantly share code, notes, and snippets.

View pedrovgs's full-sized avatar
😃

Pedro Gómez pedrovgs

😃
View GitHub Profile
@pedrovgs
pedrovgs / enqueueJobs.sh
Created August 2, 2017 08:51
Bash script to enqueue jobs using qsub
#!/bin/bash
echo "Let's enqueue some jobs ❤️"
if [ "$*" == "" ]; then
echo "We will try to enqueue every folder named Instance_X"
for dir in `find . -name "*Instance_*"`
do
echo "I've found an instance folder: $dir. Interesting 🤔"
cd $dir
qsub *.sge
@pedrovgs
pedrovgs / CrashlytisDestination.swift
Created August 24, 2018 07:57
SwiftyBeaver destination used to log error traces using Crashlytics
import Crashlytics
import Foundation
import SwiftyBeaver
import UIKit
public class CrashlyticsDestination: BaseDestination {
open override func send(_ level: SwiftyBeaver.Level, msg traceMessage: String, thread traceThread: String, file traceFile: String,
function traceFunction: String, line traceLine: Int, context _: Any? = nil) -> String? {
if level == SwiftyBeaver.Level.error {
let userInfo: [String: Any] = [
@pedrovgs
pedrovgs / .travis.yml
Created September 20, 2018 13:27
Android Travis CI config
language: android
android:
components:
- tools
- platform-tools
- build-tools-27.0.3
- android-28
- extra-android-support
- extra-google-m2repository
- extra-android-m2repository
@pedrovgs
pedrovgs / .travis.yml
Created September 20, 2018 13:28
iOS simple Travis CI configuration
language: objective-c
osx_image: xcode9.4
before_install:
- gem install cocoapods
- pod repo update --silent
- gem install xcpretty
script:
- set -o pipefail && xcodebuild -workspace KataLogInLogOutSwift.xcworkspace -scheme 'KataLogInLogOutSwift' -destination 'platform=iOS Simulator,name=iPhone 6s Plus' build test CODE_SIGN_IDENTITY=- | xcpretty -c
@pedrovgs
pedrovgs / .travis.yml
Created September 20, 2018 13:28
iOS simple Travis CI configuration
language: objective-c
osx_image: xcode9.4
before_install:
- gem install cocoapods
- pod repo update --silent
- gem install xcpretty
script:
- set -o pipefail && xcodebuild -workspace KataLogInLogOutSwift.xcworkspace -scheme 'KataLogInLogOutSwift' -destination 'platform=iOS Simulator,name=iPhone 6s Plus' build test CODE_SIGN_IDENTITY=- | xcpretty -c
@pedrovgs
pedrovgs / ExhaustiveIntentsTestRule.kt
Created February 21, 2019 12:17
Imroved IntentsTestRule implementation. This class initialized the intents components before starting the activity so we avoid a race condition between our test and the activity we are testing
package com.aplazame.utils
import android.app.Activity
import androidx.test.espresso.intent.Intents
import androidx.test.rule.ActivityTestRule
class ExhaustiveIntentsTestRule<T : Activity> : ActivityTestRule<T> {
private var isInitialized: Boolean = false
@pedrovgs
pedrovgs / android_start_bitrise_emulator.sh
Last active August 15, 2021 10:04
A ready to work emulator for Bitrise.io
#!/usr/bin/env bash
set -e
build_dir=$(pwd)
echo "Curren build dir:"
echo $build_dir
cd $ANDROID_HOME/emulator
echo "Creating sdcard image"
@pedrovgs
pedrovgs / FormValidationKata.md
Created March 30, 2019 16:36
Form validation kata statement

Most of our tasks as software engineers are related to forms. Sign up forms, sing in forms, onboarding forms, etc. So today we are going to practice how to validate any form data using accumulative errors so we can now in just one method invocation what are the errors our form contains.

Our task for today's practice is to write a program to be able to validate if the data contained in a form with the following information is valid or not.

  • First name: It can't be empty.
  • Lst name: It can't be empty.
  • Birthdate. It has to be, at least, 18 years old.
  • Document ID: A value containing eight digits and one letter.
  • Phone number: Any combination of 9 numbers.
  • Email: Any valid email.
@pedrovgs
pedrovgs / FlipperInterceptor.java
Created April 4, 2019 07:34
OkHttp version 1 client interceptor for Flipper
import com.facebook.flipper.plugins.network.NetworkFlipperPlugin;
import com.facebook.flipper.plugins.network.NetworkReporter;
import com.squareup.okhttp.*;
import okio.Buffer;
import okio.BufferedSource;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.ArrayList;
@pedrovgs
pedrovgs / AnyTestExample.kt
Last active June 16, 2021 09:01
Handling Kotlin Coroutines homogeneously
class AnyTestExample {
@Test
fun `test with coroutines`() = runBlockingTest {
sut = AnyClassUsingAsyncCode(Dispatchers.Unconfined, scope, view, api)
sut.foo()
advanceTimeBy(5000)
assertTrue(true)