Skip to content

Instantly share code, notes, and snippets.

@RohitSurwase
RohitSurwase / CoroutineIntentService.kt
Last active May 22, 2024 22:54
IntentService (Service) using Kotlin Coroutines instead of Handler+Looper.
import android.app.Service
import android.content.Intent
import android.os.IBinder
import android.support.annotation.Nullable
import android.support.annotation.WorkerThread
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.SendChannel
import kotlinx.coroutines.channels.actor
import kotlin.coroutines.CoroutineContext
@wojteklu
wojteklu / clean_code.md
Last active March 19, 2026 21:26
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@dbachelder
dbachelder / gist:9587898
Last active December 11, 2018 21:29
style the actionbar compat searchview. inspired by this article: http://nlopez.io/how-to-style-the-actionbar-searchview-programmatically/
final SupportMenuItem searchMenuItem = (SupportMenuItem) menu.findItem(R.id.menu_search);
if (searchMenuItem == null) throw new IllegalArgumentException("menu item is null and that is very suspicious.");
this.searchView = (SearchView) searchMenuItem.getActionView();
if (searchView == null) throw new IllegalArgumentException("search view is null and that is very suspicious.");
searchView.setQueryHint(getActivity().getString(R.string.search_hint));
// wow. much hack. style search box..
Resources resources = searchView.getContext().getResources();
@dweinstein
dweinstein / dbg.h
Created November 14, 2013 20:00
debug macros for C/C++ and maybe JNI android development
#ifndef __dbg_h__
#define __dbg_h__
#include <stdio.h>
#include <errno.h>
#include <string.h>
// Debug tag
#define DTAG "DBG"
@markusfisch
markusfisch / README.md
Last active November 8, 2024 08:43
Handy shell script that eases building and running Android apps from the command line with ant and adb

Handy Android shortcuts

This little script eases building, running, testing and analyzing Android apps with [ant][2] and [adb][1].

You may also see it as interactive dictionary of useful [adb commands][1].

How to use

@qrush
qrush / Inconsolata-dz-Powerline.otf
Created January 11, 2012 16:50
vim-powerline patched fonts