Skip to content

Instantly share code, notes, and snippets.

View cesarferreira's full-sized avatar

César Ferreira cesarferreira

View GitHub Profile
@cesarferreira
cesarferreira / .gitignore
Created April 7, 2017 15:05
Global gitignore ~/.gitignore
# Vim
*.sw?
.*.un~
Session.vim
# Python
*.pyc
# Ruby
.rbenv-*
@cesarferreira
cesarferreira / readme.md
Last active February 10, 2017 11:18
Git - Set upstream to different branch

Usage

git branch --set-upstream-to=origin/branch local-branch

Sample

git branch --set-upstream-to=origin/feature/auth feature/auth

@cesarferreira
cesarferreira / emulators_android.md
Last active January 24, 2017 14:02
Controlling android emulators via command line

Controlling android emulators via command line

List all your emulators:

emulator -list-avds

Run one of the listed emulators:

emulator @name-of-your-emulator

@cesarferreira
cesarferreira / logdecorator.gradle
Created October 13, 2016 14:00
Pretty print for android error logs
task testLogDecorator {
tasks.withType(Test) {
testLogging {
events "passed", "skipped", "failed", "standardOut"
showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
debug {
@cesarferreira
cesarferreira / README.md
Created August 26, 2016 10:37 — forked from jxson/README.md
README.md template

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

@cesarferreira
cesarferreira / network_availability.java
Created July 26, 2016 09:22
Check network availability
public static boolean isNetworkAvailable (Context context) {
if (connectedToTheNetwork(context)) {
try {
HttpURLConnection urlc = (HttpURLConnection)
(new URL("http://clients3.google.com/generate_204")
.openConnection());
urlc.setRequestProperty("User-Agent", "Android");
urlc.setRequestProperty("Connection", "close");
urlc.setConnectTimeout(1500);
urlc.connect();
@cesarferreira
cesarferreira / howto.md
Created February 29, 2016 10:54 — forked from neworld/howto.md
How to make faster Android build without sacrificing new api lint check

Original solution sacrifices new api lint check.

Here my solution:

int minSdk = hasProperty('minSdk') ? minSdk.toInteger() : 16

apply plugin: 'com.android.application'

android {
 compileSdkVersion 23
@cesarferreira
cesarferreira / update.sh
Created January 19, 2016 00:58 — forked from kaushikgopal/update.sh
My morning cli ritual
echo "y" | android update sdk --no-ui; echo "yes" | apm upgrade; sudo softwareupdate -i -a; brew update; brew upgrade --all; brew cleanup; brew cask cleanup; npm update npm -g; npm update -g; sudo gem update
@cesarferreira
cesarferreira / Readme.md
Created December 22, 2015 15:44 — forked from gabrielemariotti/Readme.md
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example: