This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private int performCalculations() { | |
| switch (OPERATOR) { | |
| case '+': | |
| return FIRST_NUMBER + SECOND_NUMBER; | |
| case '-': | |
| return FIRST_NUMBER - SECOND_NUMBER; | |
| case '*': | |
| return FIRST_NUMBER * SECOND_NUMBER; | |
| case '/': | |
| return FIRST_NUMBER / SECOND_NUMBER; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
| package="com.anas.voicerecognitioncalculator"> | |
| <application | |
| android:allowBackup="true" | |
| android:icon="@mipmap/ic_launcher" | |
| android:label="@string/app_name" | |
| android:roundIcon="@mipmap/ic_launcher_round" | |
| android:supportsRtl="true" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:app="http://schemas.android.com/apk/res-auto" | |
| xmlns:tools="http://schemas.android.com/tools" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| android:background="#7C616768" | |
| tools:context=".MainActivity"> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.content.Intent; | |
| import android.speech.RecognizerIntent; | |
| import android.speech.tts.TextToSpeech; | |
| import android.support.annotation.Nullable; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.os.Bundle; | |
| import android.telecom.RemoteConference; | |
| import android.view.View; | |
| import android.widget.Button; | |
| import android.widget.TextView; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MainActivity extends AppCompatActivity { | |
| TextView firstNumTextView; | |
| TextView secondNumTextView; | |
| TextView operatorTextView; | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_main); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # initialize main variables | |
| stats = {} | |
| sleep_duration = 2 | |
| nap_duration = 0.5 | |
| # initialize login credentials | |
| email_cred = 'YOUR_USERNAME_OR_EMAIL' | |
| pass_cred = 'YOUR_PASSWORD' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| from selenium import webdriver | |
| from selenium.webdriver.support.ui import WebDriverWait | |
| from selenium.webdriver.common.keys import Keys | |
| from selenium.webdriver.common.action_chains import ActionChains | |
| from selenium.webdriver.common.by import By | |
| from selenium.webdriver.chrome.options import Options |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # start webdriver | |
| options = Options() | |
| options.headless = True | |
| driver = webdriver.Chrome('/usr/bin/chromedriver', options=options) | |
| driver.get('https://medium.com/me/stats') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # choose twitter | |
| WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath('//*[@data-action="twitter-auth"]')).click() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # fill out login form | |
| username = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath('//*[@id="username_or_email"]')) | |
| password = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath('//*[@id="password"]')) | |
| login = WebDriverWait(driver, 10).until(lambda driver: driver.find_element_by_xpath('//*[@id="allow"]')) | |
| time.sleep(sleep_duration) | |
| username.clear() | |
| username.send_keys(email_cred) | |
| time.sleep(nap_duration) |