Skip to content

Instantly share code, notes, and snippets.

View igorcferreira's full-sized avatar

Igor Castañeda Ferreira igorcferreira

View GitHub Profile

Send uncaught Exceptions from Android Wear to Android

This is a short Gist showing how I transmit any uncaught exceptions happening in the Wearable part of my App to the connected Smartphone/Tablet. This is necessary because Android Wear devices are not directly connected to the Internet themselves.

##Wear

  • WearApp.java
  • AndroidManifest.xml
  • ErrorService.java
#!/usr/bin/env python
import sys
import logging
from optparse import OptionParser
import os
import gpxpy
import gpxpy.gpx
import time
from subprocess import check_output
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.Espresso.pressBack;
import static android.support.test.espresso.action.ViewActions.click;
@igorcferreira
igorcferreira / etica.txt
Last active January 27, 2017 10:08
Resposta à Bunee.io
A publicação de conteúdo em redes sociais não é uma construção de um CV público.
Assim como a contribuição com projetos open source não se caracteriza, por si só, como um portfólio de venda.
Não é porque postei receitas e fiz checkin em restaurantes que tenho pretensão em ser crítico da Michelin.
Vocês indexam e expõe devs como se os mesmos estivessem aptos a serem bombardeados com spam de empresas e propostas de freelas ou projetos irrelevantes para o profissional.
Inclusive, listando tecnologias que a pessoa não domina, gerando uma propaganda falsa.
Foram além e infringiram regras do GitHub para coleção de dados:
https://twitter.com/ezefranca/status/808344095919894529
@igorcferreira
igorcferreira / CardType.swift
Last active March 6, 2017 14:12
Basic implementation to apply different regexes over a card number String and find the card type
import Foundation
enum CardTypeError:Error {
case TypeNotFound
}
enum CardType:CustomStringConvertible {
case visa
case mastercard
case amex
@igorcferreira
igorcferreira / fizzbuzz.swift
Created July 31, 2017 22:12
This is a sample code of the resolution of the FizzBuz code test
import Foundation
//: This is a sample code of the resolution of the FizzBuz code test, explained by [Tom Scott on the YouTube](https://youtu.be/QPZ0pIK_wsc)
/// The InputRule protocol is used to abstract a type that have a specific rule
protocol InputRule {
associatedtype ModifierInput
var rule: ModifierInput { get }
}
@igorcferreira
igorcferreira / .bash_profile
Created April 10, 2018 13:48
Script to kill Xcode derived data
function killdd() {
if pgrep -x "Xcode" > /dev/null
then
killall Xcode
fi
rm -rf ~/Library/Developer/Xcode/DerivedData
open $(xcode-select --print-path)
}
@igorcferreira
igorcferreira / DynamicNavigationDestinationLink.swift
Last active September 2, 2019 11:27
Small Playground content, showcasing the use of DynamicNavigationDestinationLink to display content from remote source on SwiftUI
/// Method used to retry a UI Test check, and wait for a while before declaring failure.
/// This can be useful to bypass animation or screen transition failures.
/// The original snippet was extracted from [Javi](https://twitter.com/Javi)
/// on a [thread](https://twitter.com/Javi/status/1255181595515863042) regarding UI Test strategies.
///
/// - Parameters:
/// - test: Block that will be evaluated on each test loop
/// - description: Description of the operation. Used on fail message
/// - timeout: Maximum time that will be waited before failing
/// - fatal: Indicator if the failure on the test block will be fatal to the test or not
@igorcferreira
igorcferreira / URLRequest+Combine.swift
Last active April 28, 2020 23:17
An experiment of how to use Combine+URLRequest.
import Foundation
import Combine
import PlaygroundSupport
func request<Failure: Error, Output: Publisher>(url: URLRequest,
session: URLSession = .shared,
queue: DispatchQueue = .main,
parser: @escaping (Data) -> Output,
parseError: @escaping (Error) -> Failure,
completion: @escaping (Result<Output.Output, Failure>) -> Void) -> AnyCancellable {