Skip to content

Instantly share code, notes, and snippets.

View DelayAutoCompleteTextView
public class DelayAutoCompleteTextView extends AutoCompleteTextView {
private static final int MESSAGE_TEXT_CHANGED = 100;
private static final int DEFAULT_AUTOCOMPLETE_DELAY = 1000;
private int mAutoCompleteDelay = DEFAULT_AUTOCOMPLETE_DELAY;
private static class AvoidingMemoryLeakHandler extends Handler {
private final WeakReference<DelayAutoCompleteTextView> delayAutoCompleteTextViewWeakReference;
geniushkg / filter category in result retrofit list
Created Sep 27, 2016
sample gist to filter content from retrofit response
View filter category in result retrofit list
// this is retrofit response
Eventlist eventlist = response.body();
List<Website> websites = eventlist.getWebsites(); // website is POJO class for even as per api
List<Website> filteredWebsite = new ArrayList<Website>(); // empty list new
for(Website temp:websites){
filteredWebsite.add(temp); // is BOT or Competitive or whichever selected
package ru.mobileup.grushasdk.utils;
import android.content.Context;
* @author Vasili Chyrvon (
JIghtuse / echo_server.cxx
Last active Dec 14, 2021
echo server (select, C++)
View echo_server.cxx
#include <array>
#include <cassert>
#include <iostream>
#include <set>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>
#include <fcntl.h>
danielmai /
Created Dec 18, 2015
Espresso test for Sunshine. Demo for the Android Testing webcast in the Android Developer Nanodegree.
import android.test.suitebuilder.annotation.LargeTest;
import org.junit.Rule;
View gist:e71253f6c41179754347
yes you can
AppBarLayout appBar;
appBar.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
if(verticalOffset > -300) {
else {

1. Store api keys in a xml file

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


<?xml version="1.0" encoding="utf-8"?>
    <string name="THE_MOVIE_DB_API_TOKEN">XXXXX</string>
marty-wang / gist:5a71e9d0a6a2c6d6263c
Last active Jul 21, 2021
Compile and deploy React Native Android app of Release version to device.
View gist:5a71e9d0a6a2c6d6263c
Disclaimer: The instructions are the collective efforts from a few places online.
Nothing here is my original. But I want to put them together in one place to save people from spending the same time as I did.
First off, bundle.
1. cd to the project directory
2. Start the react-native packager if not started
3. Download the bundle to the asset folder:
curl "http://localhost:8081/" -o "android/app/src/main/assets/"
View wtf.js
/* VT100 terminal reset (<ESC>c) */
/* numbers comparations */
> '2' == 2
> '2' === 2
M-Medhat / RegExReplace.swift
Created Feb 2, 2015
Regular Expressions: How to replace patterns in Swift
View RegExReplace.swift
// You need to import Foundation to use NSRegularExpression, NSError and NSString
import Foundation
/// This function takes three parameters
/// text: a string that we search in
/// pattern: a reqular expression pattern to use in the search
/// withTemplate: the string that we use instead of the occurrances we find in text
/// The method returns (text) with occurrance found using (pattern) replaced with (withTemplate)
func regexReplace(text:String, pattern:String, withTemplate:String) -> String {