Skip to content

Instantly share code, notes, and snippets.

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

Nishit nishitpatel

🏠
Working from home
  • Kotak Securities Pvt. Ltd.
  • Navi Mumbai
View GitHub Profile
@nishitpatel
nishitpatel / ApplicationInformation
Last active August 29, 2015 14:02
Get Only Installed App List in Android
package com.vs2.applockfree.objects;
import java.util.ArrayList;
import java.util.List;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
@nishitpatel
nishitpatel / gist:e46b252f05b397929ba6
Created June 26, 2014 07:31
Handel Soft keyboard Go,Next,Done Text event.
edittext.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId,
KeyEvent event) {
// TODO Auto-generated method stub
if (actionId == EditorInfo.IME_ACTION_GO) {
//Do your task on go text click from keyboard
}
@nishitpatel
nishitpatel / ApplicationListAdpater
Created June 30, 2014 05:15
Create DBHelper,database Function and adapter class in android.
package com.vs2.applockfree.adapters;
import java.util.ArrayList;
import android.content.Context;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@nishitpatel
nishitpatel / ContactListAdapter.java
Created July 8, 2014 10:36
Display List View in custom Dialog in android.
package com.vs2.sheduledsms.adpaters;
import java.util.ArrayList;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@nishitpatel
nishitpatel / distancecoordinates
Created July 22, 2014 09:19
Find distance between two coordinates in km.
private float getDistanceBetweenCoordinates(double latitude1,
double longitude1, double latitude2, double longitude2) {
Location locationA = new Location("point A");
locationA.setLatitude(latitude1);
locationA.setLongitude(longitude1);
Location locationB = new Location("point B");
locationB.setLatitude(latitude2);
locationB.setLongitude(longitude2);
float meter = locationA.distanceTo(locationB);
@nishitpatel
nishitpatel / Utility.m
Last active August 29, 2015 14:25
Objectice C common function which used in daily programming.
//Get UIColor from Hex color code
+(UIColor *)colorFromHexString:(NSString *)hexString {
unsigned rgbValue = 0;
NSScanner *scanner = [NSScanner scannerWithString:hexString];
[scanner setScanLocation:1]; // bypass '#' character
[scanner scanHexInt:&rgbValue];
return [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16)/255.0 green:((rgbValue & 0xFF00) >> 8)/255.0 blue:(rgbValue & 0xFF)/255.0 alpha:1.0];
}
//Set Bottom Border to UITextField
Link1: Sort array in java good explaintation.
http://www.webcodegeeks.com/javascript/javascript-sort-array-example/?utm_content=buffer3d3fb&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer
@nishitpatel
nishitpatel / MYSQL commands
Last active December 28, 2015 11:55
MySql Commands.
Command 1: Display all foriegn key constraint related to table
Query: select TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME from INFORMATION_SCHEMA.KEY_COLUMN_USAGE where REFERENCED_TABLE_NAME = 'outlets'
Command 2: Drop Foriegn Key Constraint related to table
Query: ALTER TABLE 'Table Name' DROP FOREIGN KEY 'Foriegn Key Name'
@nishitpatel
nishitpatel / AppDelegate
Created January 12, 2017 11:54
UITabBarController Customization 1. UITabBar Shift to Top of the Screen, 2.Add Custome Bottom Border, 3. Add Left to Right swipe effect
//Add Below code to App Delegate .m file
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
[[UITabBar appearance] setShadowImage:[[UIImage alloc]init]];
[[UITabBarItem appearance] setTitleTextAttributes:@{
NSFontAttributeName:[UIFont fontWithName:@"Helvetica-Bold" size:14.0f],NSForegroundColorAttributeName : [Utility getUIColorFromHexString:INACTIVE_TAB_TEXT_COLOR]
} forState:UIControlStateNormal];
@nishitpatel
nishitpatel / Links
Created February 6, 2017 09:39
Aswome Menu library for IOS