Skip to content

Instantly share code, notes, and snippets.

View pookie13's full-sized avatar

Piyush Gupta pookie13

View GitHub Profile
<!DOCTYPE html>
<html ng-app="" ng-controller="myCtrl">
<body>
<input value="sample input value" ng-click="getCursorPos($event)" ng-keyup="getCursorPos($event)" id="searchTxt" type="text" />
<button ng-click="showAlert()">
<div> Cursor Position : <b ng-bind="pos"></b></div>
<script>
function myCtrl($scope) {
$scope.pos = document.getElementById('searchTxt').value.length ;
$scope.cursorPosVal = -1;
@pookie13
pookie13 / TImePickerDialog.java
Created February 17, 2016 06:46
TIme Range picker
package com.app.pointme.voicenotificaction;
import android.app.DialogFragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
public class FontChangeCrawler
{
private Typeface typeface;
public FontChangeCrawler(Typeface typeface)
{
this.typeface = typeface;
}
public FontChangeCrawler(AssetManager assets, String assetsFontFileName)
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.goparties.gpuser.util.CropImageView;
import java.io.IOException;
import butterknife.Bind;
in Application class
@Override
public void uncaughtException(Thread thread, Throwable throwable) {
//throwable will tell you the resion of crash
PendingIntent pendingIntent = PendingIntent.getActivity(getBaseContext(), 0,
new Intent(this, WelcomeActivity.class), PendingIntent.FLAG_CANCEL_CURRENT);//pass Activity that you want to start at fatal.
AlarmManager mgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 500, pendingIntent);
System.exit(2);
@pookie13
pookie13 / counties
Created July 8, 2015 06:55
Countries code
[
{
"name": "Afghanistan",
"alpha-2": "AF",
"alpha-3": "AFG",
"country-code": "004",
"iso_3166-2": "ISO 3166-2:AF",
"region-code": "142",
"sub-region-code": "034"
},
@pookie13
pookie13 / gist:a49d1ebd14580ecf7050
Last active August 29, 2015 14:23
spacial Charecters
&quot; "
&amp; &
&apos; '
&lt; <
&gt; >
\u0020 " "
@pookie13
pookie13 / AsyncHelper.java
Created June 16, 2015 08:23
AsyncTask Class to Call multiple service
import android.app.Activity;
import android.os.AsyncTask;
import android.util.Log;
import com.google.gson.Gson;
import com.hestabit.rqchat.connect.Connect;
import com.hestabit.rqchat.models.SignUp;
import org.apache.http.NameValuePair;
@pookie13
pookie13 / DataBaseDl.java
Created June 5, 2015 06:22
DataBase Function.
// insert template in to DB(query)
public long insertdata(Model model) {
String sql = "INSERT INTO " + Databaseconnector.TABLE_TEMPLET
+ "(UNIQUEID,TEMPLET) VALUES (?,?)";
SQLiteStatement objStmt = sqliteDatabase.compileStatement(sql);
objStmt.bindString(1, Commonvariable.getUniqueID());
Log.d("tempValue", ""+model.getTemplet());
string=templetOb.getTemplet();
objStmt.bindString(2, templetOb.getTemplet());
long longValue = objStmt.executeInsert();
@pookie13
pookie13 / SharedHelper.java
Created June 5, 2015 05:58
Common function used in project.
public class SharedHelper {
private static NotificationManager mNotificationManager;
private static Class<?> aClass;
private static ProgressDialog progressDialog;
private static Uri mBaseUri;
private static SharedPreferences.Editor editor;
private static SharedPreferences pref;
private static Class<?> mClass;