Skip to content

Instantly share code, notes, and snippets.

View badarshahzad's full-sized avatar
🏢
Jr. Software Engineer

Badar Khan ツ badarshahzad

🏢
Jr. Software Engineer
  • Junior Full Stack Develper at Speridian Technologies. #ReactNative #React #Android and lover of <3 JavaScript #ReactNative #React #Android and lover of <3 JavaScript
  • Lahore, Punjab, Pakistan
View GitHub Profile
//Get the all countries name
public static ArrayList<String> getCountriesName() {
ArrayList<String> list = new ArrayList<String>();
String[] locales = Locale.getISOCountries();
for (String countryCode : locales) {
Locale obj = new Locale("", countryCode);
@badarshahzad
badarshahzad / README.md
Created October 26, 2018 18:39
BucketListApp Activities

Faced Error:

A problem occurred evaluating root project 'BucketListApp'.

Could not find method google() for arguments [] on repository container.

@badarshahzad
badarshahzad / commands.js
Created October 11, 2018 05:12
Here is the couple commands for the Android & React Native
/*******************
* Android
*******************/
Where is the emuator in your directory:
/root/Android/Sdk/emulator
$> ./emulator -list-avds
@badarshahzad
badarshahzad / TextviewButton.js
Created July 12, 2018 12:24
How does map((word) => word && '🇵🇰').join(' ') actually working ? well I know how the map works but why 'word && '🇵🇰' is needed. Because if I remove the word with && then the flag already appeared before any text. While if this same code sample execute then only flag will be appeared only if the word is typed in the Textview. Can you enlighten m…
import React from 'react';
import { StyleSheet, Text, View, TextInput, Alert, Button, FlatList, Image } from 'react-native';
import { ViewPagerAndroid } from 'react-native-gesture-handler';
let dumiDataArray = [{ key: 'Badar' },
{ key: 'Khan' },
{ key: 'Badri' },
{ key: 'Sudo' },
{ key: 'Kaka' },
{ key: 'Khan' },
@badarshahzad
badarshahzad / basicJavaScriptLookUp.js
Created June 27, 2018 13:39
Basic JavaScript: Profile Lookup We have an array of objects representing different people in our contacts lists. A lookUpProfile function that takes name and a property (prop) as arguments has been pre-written for you. The function should check if name is an actual contact's firstName and the given property (prop) is a property of that contact.…
//Setup
var contacts = [
{
"firstName": "Akira",
"lastName": "Laine",
"number": "0543236543",
"likes": ["Pizza", "Coding", "Brownie Points"]
},
{
"firstName": "Harry",
@badarshahzad
badarshahzad / DashboardFragment.java
Created April 19, 2018 04:29
The Gpio pin work as a static fine but to work as normal like creation of gpio pin as a private or public variable at class level or in life cycle of fragment didn't work.
package com.badarshahzad54.pcbs.presentation.fragments;
import android.app.Fragment;
import android.content.Context;
import android.content.DialogInterface;
import android.content.SharedPreferences;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@badarshahzad
badarshahzad / MainActivity.java
Last active April 17, 2018 05:25
The static variable for Gpio pin work but withou static its not working.
/**
* A simple {@link Fragment} subclass.
*/
public class DashboardFragment extends Fragment implements DeviceRecyclerAdapter.ListItemClickListeners,
OnBoomListener, SelectIconInterface {
private static final String TAG = DashboardFragment.class.getSimpleName();
private static final String APPLIANCES_KEY = "appliances_key";
@badarshahzad
badarshahzad / MCP3008.java
Last active April 3, 2018 16:38
Android Things MCP3008 example
package com.badarshahzad54.pcbs.mcp3008;
import com.google.android.things.pio.Gpio;
import com.google.android.things.pio.PeripheralManagerService;
import java.io.IOException;
/*
Paul Trebilcox-Ruiz
@badarshahzad
badarshahzad / background.xml
Created March 15, 2018 13:05
Add background xml view
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/colorDark" />
<size android:width="42dp"
android:height="42dp"/>
</shape>
@badarshahzad
badarshahzad / Error Log
Created January 21, 2018 21:11
Things application Error Log
01-21 21:08:36.577 1810-1859/com.badarshahzad54.pcbs E/FA: Discarding data. Failed to send app launch
01-21 21:08:36.578 1810-1859/com.badarshahzad54.pcbs E/FA: Failed to get app instance id
01-21 21:08:36.579 1810-1859/com.badarshahzad54.pcbs E/FA: Failed to send current screen to service
01-21 21:08:36.580 1810-1859/com.badarshahzad54.pcbs E/FA: Discarding data. Failed to send event to service
01-21 21:09:01.279 1810-1859/com.badarshahzad54.pcbs E/FA: Failed to send current screen to service
01-21 21:09:01.279 1810-1859/com.badarshahzad54.pcbs E/FA: Discarding data. Failed to send event to service