Skip to content

Instantly share code, notes, and snippets.

View ppamorim's full-sized avatar
🎯
Focusing

Pedro Paulo Amorim ppamorim

🎯
Focusing
View GitHub Profile
@fjcaetano
fjcaetano / codecov.rb
Last active February 8, 2021 19:59
Codecov Fastlane action
module Fastlane
module Actions
class CodecovAction < Action
def self.run(params)
ci_only = params[:ci_only]
cmd = ['curl -s https://codecov.io/bash | bash']
cmd << "-s --" if params.all_keys.inject(false) { |p, k| p or params[k] }
cmd << "-X xcodeplist" if params[:use_xcodeplist]
cmd << "-J '#{params[:project_name]}'" if params[:project_name]
@pthiers
pthiers / PHP-Array.groovy
Last active March 7, 2024 14:26
datagrip php array extractor
/*
* Available context bindings:
* COLUMNS List<DataColumn>
* ROWS Iterable<DataRow>
* OUT { append() }
* FORMATTER { format(row, col); formatValue(Object, col) }
* TRANSPOSED Boolean
* plus ALL_COLUMNS, TABLE, DIALECT
*
* where:
@juanchosaravia
juanchosaravia / KotlinParcelable
Last active February 28, 2019 12:10
How to use Parcelable in Kotlin v1.0.0-beta-4589
// ------------ Helper extension functions:
// Inline function to create Parcel Creator
inline fun <reified T : Parcelable> createParcel(crossinline createFromParcel: (Parcel) -> T?): Parcelable.Creator<T> =
object : Parcelable.Creator<T> {
override fun createFromParcel(source: Parcel): T? = createFromParcel(source)
override fun newArray(size: Int): Array<out T?> = arrayOfNulls(size)
}
// custom readParcelable to avoid reflection
package br.com.ngi.ginga.business.util.seq;
/**
* Copyright (C) 2015 - NG Informática
*
* @author Marcelo Camargo
* @since 08/12/2015
*/
public interface Function<Ret, Arg> {
Ret call(Arg arg);
@gabrielemariotti
gabrielemariotti / README.md
Last active February 24, 2021 10:52
How to manage the support libraries in a multi-module projects. Thanks to Fernando Cejas (http://fernandocejas.com/)

Centralize the support libraries dependencies in gradle

Working with multi-modules project, it is very useful to centralize the dependencies, especially the support libraries.

A very good way is to separate gradle build files, defining something like:

root
  --gradleScript
 ----dependencies.gradle
@fatorx
fatorx / InvertRecyclerView
Last active September 21, 2018 17:37
Para inverter a ordem dos itens de um recycler view, para ficar parecido com o formato de mensagens do WhatsApp
recyclerView = (RecyclerView) findViewById(R.id.rvMessagesList);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(MessageThreadActivity.this);
linearLayoutManager.setStackFromEnd(true);
linearLayoutManager.setReverseLayout(false);
recyclerView.setLayoutManager(linearLayoutManager);
@ferdy182
ferdy182 / CircularRevealingFragment.java
Created March 27, 2015 17:18
Make circular reveal animations on a fragment
/**
* Our demo fragment
*/
public static class CircularRevealingFragment extends Fragment {
OnFragmentTouched listener;
public CircularRevealingFragment() {
}
@Sloy
Sloy / MockParcel.java
Created February 26, 2015 12:50
MockParcel for testing Parcelables implementations with the new Android's Unit testing support (http://tools.android.com/tech-docs/unit-testing-support). Only String and Long read/write implemented here. Add mock methods for other types.
import android.os.Parcel;
import java.util.ArrayList;
import java.util.List;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doAnswer;
@gabrielemariotti
gabrielemariotti / README.md
Last active March 9, 2023 06:02
A SectionedGridRecyclerViewAdapter: use this class to realize a simple sectioned grid `RecyclerView.Adapter`.

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

Screen

The RecyclerView has to use a GridLayoutManager.

This is a porting of the class SimpleSectionedListAdapter provided by Google

If you are looking for a sectioned list RecyclerView.Adapter you can take a look here

import Foundation
extension String
{
var length: Int {
get {
return countElements(self)
}
}