Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Valeria Rogatchevskikh valllllll2000

🎯
Focusing
View GitHub Profile
@juliusspencer
juliusspencer / WeatherStationActivity.java
Created Apr 24, 2017
Modified Weatherstation Codelab Activity to handle CPU temperature
View WeatherStationActivity.java
/*
* 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
@arcadefire
arcadefire / RecyclerViewExtension.kt
Last active Aug 31, 2020
Add addOnItemClickListener easily to a RecyclerView using Kotlin
View RecyclerViewExtension.kt
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?) {
View store_api_keys.md

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 Sep 28, 2020
Getting latest tag on git repository
View get-latest-tag-on-git.sh
# 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
@henrytao-me
henrytao-me / RecycleEmptyErrorView.java
Last active Dec 13, 2016
Empty and Error in RecycleView
View RecycleEmptyErrorView.java
/*
* 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
@iperdomo
iperdomo / commit-msg
Last active Feb 25, 2019
Simple Git commit hook to enforce adding an issue number
View commit-msg
#!/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 Nov 2, 2010
Detect file change using FileObserver on Android
View 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 |
You can’t perform that action at this time.