Skip to content

Instantly share code, notes, and snippets.

View hardikamal's full-sized avatar
🖥️

Hardik Amal hardikamal

🖥️
View GitHub Profile
@hardikamal
hardikamal / LocalBroadcastExampleActivity.java
Created April 21, 2016 09:46 — forked from Antarix/LocalBroadcastExampleActivity.java
Simple Example of using LocalBroadcastManager in Android
import android.app.Activity;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v4.content.LocalBroadcastManager;
@hardikamal
hardikamal / SearchViewStyle.java
Created March 5, 2016 11:37 — forked from jaredrummler/SearchViewStyle.java
Customize the SearchView in an ActionBar for Android
/*
* Copyright (C) 2015 Jared Rummler <jared.rummler@gmail.com>
*
* 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
/*
* Copyright (C) 2006 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
@hardikamal
hardikamal / MyCalendar.h
Created February 16, 2016 14:15 — forked from martinsik/MyCalendar.h
Example of using EventKit on iOS 6+
#import <Foundation/Foundation.h>
@interface MyCalendar : NSObject
+ (void)requestAccess:(void (^)(BOOL granted, NSError *error))success;
+ (BOOL)addEventAt:(NSDate*)eventDate withTitle:(NSString*)title inLocation:(NSString*)location;
@end
@hardikamal
hardikamal / HeaderFooterRecyclerViewAdapter.java
Created January 20, 2016 11:30 — forked from mheras/HeaderFooterRecyclerViewAdapter.java
Header & footer support for RecyclerView.Adapter
public abstract class HeaderFooterRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static final int VIEW_TYPE_MAX_COUNT = 1000;
private static final int HEADER_VIEW_TYPE_OFFSET = 0;
private static final int FOOTER_VIEW_TYPE_OFFSET = HEADER_VIEW_TYPE_OFFSET + VIEW_TYPE_MAX_COUNT;
private static final int CONTENT_VIEW_TYPE_OFFSET = FOOTER_VIEW_TYPE_OFFSET + VIEW_TYPE_MAX_COUNT;
private int headerItemCount;
private int contentItemCount;
private int footerItemCount;
package com.hardik.headerfooterrecycleview;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
@hardikamal
hardikamal / gist:3253ee13856b82e2764a
Created January 20, 2016 11:21 — forked from ec84b4/gist:d56c00fb5fd2dfaf279b
recycler view header adapter
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
/**
* Created by khaled bakhtiari on 10/26/2014.
* <a href="http://about.me/kh.bakhtiari">
*/
import fb #To install this package run: sudo pip install fb
from facepy import GraphAPI #To install this package run: sudo pip install facepy
import time
token=""#Insert access token here.
facebook=fb.graph.api(token)
graph1 = GraphAPI(token)
vid=102988293558 #This is flipkart page's facebook id
query=str(vid)+"/posts?fields=id&limit=5000000000"
r=graph1.get(query)
idlist=[x['id'] for x in r['data']]
@hardikamal
hardikamal / API.md
Created November 3, 2015 10:46 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@hardikamal
hardikamal / AbstractRecyclerViewFooterAdapter.java
Last active October 29, 2015 18:15 — forked from mSobhy90/AbstractRecyclerViewFooterAdapter.java
An example of how-to implement an infinite scrolling adapter for a RecyclerView, with a ProgressBar footer. Blog post can be found here: http://msobhy.me/2015/09/05/infinite_scrolling_recyclerview/
package net.sarmady.contactcarswithtabs.adapters;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;