Skip to content

Instantly share code, notes, and snippets.

View CarlosACepeda's full-sized avatar
🏍️
Riding my bike

Carlos Cepeda CarlosACepeda

🏍️
Riding my bike
  • UndergroundDev
  • Bogotá, Colombia
View GitHub Profile
@CarlosACepeda
CarlosACepeda / convertanicon.cs
Created March 28, 2018 21:47
This is a snippet in how to Convert <Android.Graphics.Drawables.Icon> to <Android.Graphics.Drawables.Drawable> [c#] [Android][Xamarin.Android]
//Static: No need to make an instance to call this method.
// Receives two arguments:
//Icon: the Icon to convert:
//Paquete: Package of the app where the icon resides, needed to retrieve an icon from another application.
public static Drawable ReturnActionIconDrawable(Icon icon, string paquete)
{
//New Context field.
Context remotePackageContext = null;
//Create a context using the package passed in <paquete>
package pl.pszklarska.leakexample;
import android.content.Context;
import android.widget.Toast;
public class StaticContextLeak {
private static Context context;
public void setContext(final Context context) {
@CarlosACepeda
CarlosACepeda / KeyboardUtils.java
Created October 24, 2019 20:58 — forked from lopspower/KeyboardUtils.java
Force Hide Keyboard Android
import android.app.Activity;
import android.content.Context;
import android.graphics.Rect;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
public class KeyboardUtils {
public static void hideKeyboard(Activity activity) {
View view = activity.findViewById(android.R.id.content);
@CarlosACepeda
CarlosACepeda / git-commit-author-rewrite.md
Created September 24, 2020 01:32 — forked from trey/git-commit-author-rewrite.md
Change the email address for a git commit.

Change the email address for a git commit.

$ git commit --amend --author="Author Name <email@address.com>"

or

$ git commit --amend --reset-author
@CarlosACepeda
CarlosACepeda / FirestoreRepository.java
Created May 18, 2021 01:05 — forked from NiPfi/FirestoreRepository.java
Basic implementation of a repository pattern for Firebase Firestore
package ch.jojoni.jamplan.model.repository;
import android.support.annotation.NonNull;
import android.util.Log;
import com.google.android.gms.tasks.Continuation;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.DocumentReference;