Skip to content

Instantly share code, notes, and snippets.

View trinadhkoya's full-sized avatar
💭
I may be slow to respond.

trinadhkoya trinadhkoya

💭
I may be slow to respond.
View GitHub Profile
a single * in python changes the whole thing
In this example ,i am working with backend server to validate my credentials.unfortunately i got the error like Wrong Credentials.
putting before * makes sense for me for that f****g problem
@trinadhkoya
trinadhkoya / gist:079a26be709f973250b72d72f8155653
Created December 12, 2016 05:52
generate SHA-1 fingerprint using java keytool On Windows
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
USERPROFILE -->C:\Users\trina\.android\debug.keystore
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).
The Max widths are as follows
@trinadhkoya
trinadhkoya / location-fetch-two-way
Created March 17, 2017 04:42
Better way of getting the user's location in Android
/**
* try to get the 'best' location selected from all providers
*/
private Location getBestLocation() {
Location gpslocation = getLocationByProvider(LocationManager.GPS_PROVIDER);
Location networkLocation =
getLocationByProvider(LocationManager.NETWORK_PROVIDER);
// if we have only one location available, the choice is easy
if (gpslocation == null) {
Log.d(TAG, "No GPS Location available.");
Code Structure
activities
Contains all the activities. Classes are all named with Activity at the end. That way, you can immediately know what it is when reading Java code that doesn't have its full package name.
adapters
Contains all the adapters.
@trinadhkoya
trinadhkoya / Locator.java
Created April 21, 2017 16:38 — forked from emil2k/Locator.java
Android utility class for getting device location using various methods.
package com.emil.android.util;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
/**
@trinadhkoya
trinadhkoya / NetworkHelper.java
Created April 25, 2017 15:08 — forked from alphamu/NetworkHelper.java
Gist showing the use case of a headless Fragment to check if internet is available
public class NetworkHelper extends Fragment {
public static final String TAG = "NetworkHelper";
public static final String CHECK_INTERNET = "network_connection";
private Activity mActivity;
AlertDialog mAlertDialog = null;
private BroadcastReceiver onNotice = new BroadcastReceiver() {
@Override
@trinadhkoya
trinadhkoya / HOC_Authentication
Last active December 22, 2018 05:52
An HOC which checks authentication in every container/screen
import React, {Component} from 'react'
import {connect} from 'react-redux'
export default function (ComposedComponent) {
class Authentication extends Component {
componentWillMount() {
if (!this.props.authenticated) this.props.navigation.navigate('LoginForm')
}
@trinadhkoya
trinadhkoya / imageIco.js
Created December 25, 2018 14:42
Convert SVG code to JS code with Dynamic Props
import React from 'react'
import PropTypes from 'prop-types';
import Svg, {G, Path} from "react-native-svg";
class ImageIco extends React.Component {
constructor(props) {
super(props);
}
render() {
@trinadhkoya
trinadhkoya / SessionCheckHOC.js
Last active December 25, 2018 16:45
This gist is about checking the authentication on every component
import React, {Component} from 'react'
import {connect} from 'react-redux'
export default function (ComposedComponent) {
class Authentication extends Component {
componentWillMount() {
if (!this.props.authenticated) this.props.navigation.navigate('LoginForm')
}