Skip to content

Instantly share code, notes, and snippets.

View InfiniteScrollListener.java
package io.plaidapp.ui.recyclerview;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import io.plaidapp.data.DataLoadingSubject;
/**
@amilcar-andrade
amilcar-andrade / VoiceActivity.java
Last active Apr 15, 2020
arghhhhh! stupid FragmentTranstions
View VoiceActivity.java
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.transition.Fade;
import androidx.appcompat.app.AppCompatActivity;
/** VoiceActivity 2.0 */
public class VoiceActivity extends AppCompatActivity {
VoiceFragment mVoiceFragment = new VoiceFragment();
@amilcar-andrade
amilcar-andrade / Palindrome.java
Created May 25, 2017
isPalindrome implementation
View Palindrome.java
import java.io.*;
import java.util.*;
/*
* To execute Java, please define "static void main" on a class
* named Solution.
*
* If you need more classes, simply define them inline.
456654 => true
@amilcar-andrade
amilcar-andrade / Anagrams.java
Created May 25, 2017
Implementation of the isAnagram problem and groupAnagrams
View Anagrams.java
import java.util.*;
class Main {
public static void main(String[] args) {
List<String> words = new ArrayList<>(Arrays.asList("a", "b", "a", "d"));
List<List<String>> g = groupAnamgrams(words);
System.out.println(g);
}
public static List<List<String>> groupAnamgrams(List<String> anagrams){
if (anagrams == null || anagrams.isEmpty()) {
View WordDistanceFinder.java
/* This class will be given a list of words (such as might be tokenized
* from a paragraph of text), and will provide a method that takes two
* words and returns the shortest distance (in words) between those two
* words in the provided text.
* Example:
* WordDistanceFinder finder = new WordDistanceFinder(Arrays.asList("the", "quick", "brown", "fox", "quick"));
* assert(finder.distance("fox", "the") == 3);
* assert(finder.distance("quick", "fox") == 1);
*
* "quick" appears twice in the input. There are two possible distance values for "quick" and "fox":
View profile.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
@amilcar-andrade
amilcar-andrade / SantaSecret.java
Last active Oct 15, 2016
SantaSecret basic implementation
View SantaSecret.java
import java.util.*;
public class SantaSecret {
public static void main(String[] args) {
String[][] list = generateList(new String[]{"amilcar", "andrade", "garcia"});
for (int i = 0; i < list.length; i++) {
System.out.println("From: " + list[i][0] + " To: " + list[i][1]);
}
}
View collapsing_toolbar_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout android:id="@+id/main_content"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="128dp"
@amilcar-andrade
amilcar-andrade / LinkifyTextView.java
Last active Aug 22, 2017
@TextView that only responds to touch events of links
View LinkifyTextView.java
public class LinkifyTextView extends TextView {
public LinkifyTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public LinkifyTextView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
@amilcar-andrade
amilcar-andrade / gist:3400851
Last active Oct 8, 2015
Pyhton: Calculator Parser
View gist:3400851
import sys
class Number:
def __init__(self, lexeme):
self.lexeme = lexeme
class OpenParenthesis:
lexeme ="("
class CloseParenthesis:
You can’t perform that action at this time.