Skip to content

Instantly share code, notes, and snippets.

View geniushkg's full-sized avatar
🏠
Working from home

Hardik geniushkg

🏠
Working from home
View GitHub Profile
@geniushkg
geniushkg / numberOfColumn
Created June 24, 2016 05:22
A simple method helper for grid in android to be dynamic in number of columns
public int numOfColumnsForOrientation() {
Display display = getActivity().getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
int numOfColoums = 0;
if (width < height) {
// portrait mode
numOfColoums = 2;
if (width > 600) { // for tablet sw600
numOfColoums = 3;
import java.util.*;
public class QueueSample{
public static void main(String args[]){
Queue<Character> queVar = new LinkList<Character>();
System.out.println("Adding new character to queue.");
queVar.add('A');
@geniushkg
geniushkg / filter category in result retrofit list
Created September 27, 2016 05:03
sample gist to filter content from retrofit response
// 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){
if(temp.getCategory().equalsIgnoreCase(sortType.name())){
filteredWebsite.add(temp); // sortType.name() is BOT or Competitive or whichever selected
}
}