Skip to content

Instantly share code, notes, and snippets.


Kshitij Aggarwal funkyidol

View GitHub Profile
funkyidol / applozic.d.ts
Last active Nov 20, 2017
Applozic Web chat Integration
View applozic.d.ts
interface AppLozicStatic {
initPlugin(): any;
declare var AppLozic : AppLozicStatic;
export = AppLozic;
package com.sample.medicalconferenceapp.login;
import android.text.TextUtils;
import com.sample.medicalconferenceapp.R;
import com.sample.medicalconferenceapp.login.LoginContract.Presenter;
import com.sample.medicalconferenceapp.model.UserRepo;
import com.sample.medicalconferenceapp.model.pojo.UserPojo;
funkyidol /
Created Mar 21, 2016
RealmHelper class to create a singular place for handling Realm instances
public class RealmHelper {
private static RealmConfiguration config;
private static Realm realmInstance;
public static Realm getWriteInstance(Context context) {
if (realmInstance == null || realmInstance.isClosed()) {
// TODO: 15/10/15 Update the code to use Realm.isClosed()
realmInstance = getInstance(context);
import android.accounts.Account;
import android.accounts.AccountManager;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import com.facebook.AppEventsLogger;
import com.facebook.Session;
import com.facebook.SessionState;
funkyidol /
Created Oct 3, 2013
Date/Time formatter
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
//get current date time with Calendar()
Calendar cal = Calendar.getInstance();
funkyidol /
Created Oct 3, 2013
Read small files from storage
BufferedReader br = new BufferedReader(new FileReader("file.txt"));
try {
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
line = br.readLine();
funkyidol /
Last active Dec 24, 2015
Starting Service at specific intervals controlled using AlarmManager
Calendar cal = Calendar.getInstance();
Intent intent = new Intent(this, MyService.class);
PendingIntent pintent = PendingIntent.getService(this, 0, intent, 0);
AlarmManager alarm = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
// Start every 30 seconds
alarm.setRepeating(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), 30*1000, pintent);