Skip to content

Instantly share code, notes, and snippets.

View valllllll2000's full-sized avatar
🎯
Focusing

Valeria R valllllll2000

🎯
Focusing
View GitHub Profile
@henrytao-me
henrytao-me / RecycleEmptyErrorView.java
Last active December 13, 2016 15:42
Empty and Error in RecycleView
/*
* Copyright 2015 "Henry Tao <hi@henrytao.me>"
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@juliusspencer
juliusspencer / WeatherStationActivity.java
Created April 24, 2017 01:08
Modified Weatherstation Codelab Activity to handle CPU temperature
/*
* Copyright 2017, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@iperdomo
iperdomo / commit-msg
Last active February 25, 2019 11:42
Simple Git commit hook to enforce adding an issue number
#!/bin/sh
if [[ -z "$(head -n1 "$1" | grep -o -E '#[0-9]+')" ]]; then
echo >&2 ERROR: Commit message must include issue number.
exit 1
fi
exit 0
@shirou
shirou / FileObserver on Android
Created November 2, 2010 02:24
Detect file change using FileObserver on Android
private class PathFileObserver extends FileObserver{
static final String TAG="FILEOBSERVER";
/**
* should be end with File.separator
*/
String rootPath;
static final int mask = (FileObserver.CREATE |
FileObserver.DELETE |
FileObserver.DELETE_SELF |
FileObserver.MODIFY |
@arcadefire
arcadefire / RecyclerViewExtension.kt
Last active April 20, 2023 10:14
Add addOnItemClickListener easily to a RecyclerView using Kotlin
import android.support.v7.widget.RecyclerView
import android.view.View
interface OnItemClickListener {
fun onItemClicked(position: Int, view: View)
}
fun RecyclerView.addOnItemClickListener(onClickListener: OnItemClickListener) {
this.addOnChildAttachStateChangeListener(object: RecyclerView.OnChildAttachStateChangeListener {
override fun onChildViewDetachedFromWindow(view: View?) {

1. Store api keys in a xml file

Put xml file "api_keys.xml" in the directory "res/value/".

api_keys.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string name="THE_MOVIE_DB_API_TOKEN">XXXXX</string>
</resources>
@rponte
rponte / get-latest-tag-on-git.sh
Last active March 11, 2024 07:50
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples