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
== Adb Server | |
adb kill-server | |
adb start-server | |
== Adb Reboot | |
adb reboot | |
adb reboot recovery | |
adb reboot-bootloader | |
== Shell |
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
###1. FIND THE LONGEST WORD | |
["hello", "world", "hi", "bye"] | |
###Solution: | |
Given that there is only one longest word in the Array or the first longest word is a valid | |
```kotlin | |
fun findLongestWord(words: List<String>): String { | |
var longestWord = "" | |
words.onEach { word -> if(word.length > longestWord.length) longestWord = word } | |
return longestWord |
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"?> | |
<androidx.constraintlayout.motion.widget.MotionLayout | |
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:id="@+id/motionLayout" | |
app:layoutDescription="@xml/onboarding_scene" | |
android:background="@color/onboarding_background" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> |
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
class OnboardingBubbleItem | |
@kotlin.jvm.JvmOverloads | |
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : FrameLayout(context, attrs, defStyleAttr) { | |
init { initView(attrs) } | |
private fun initView(attrs: AttributeSet?) { | |
View.inflate(context, R.layout.layout_bubble_item, this) | |
val ta = context.obtainStyledAttributes(attrs, R.styleable.OnboardingBubbleItem) |
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"?> | |
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto"> | |
<Transition | |
app:constraintSetStart="@id/firstTransition" | |
app:constraintSetEnd="@id/secondTransition" | |
app:duration="500"> | |
</Transition> |
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
class OnboardingFragment : DialogFragment() { | |
private val indicators = mutableListOf<View>() | |
private var currentPosition = 0 | |
private fun attachNextButtonListener() { | |
next.setOnClickListener { | |
when (currentPosition) { | |
0 -> next.navigate(R.id.firstTransition, R.id.secondTransition) | |
1 -> next.navigate(R.id.secondTransition, R.id.thirdTransition) | |
else -> dismiss() |
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
// functions/index.js | |
const admin = require('firebase-admin'); | |
const functions = require('firebase-functions'); | |
// path to a service account key JSON file | |
const serviceAccount = require("./account_key.json"); | |
// Lightweight JavaScript date library for parsing, validating, | |
// manipulating, and formatting dates. | |
const moment = require('moment'); | |
// Serpwow module | |
const SerpWow = require('google-search-results-serpwow'); |
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
// functions/index.js | |
const admin = require('firebase-admin'); | |
const functions = require('firebase-functions'); | |
// Path to a service account key JSON file | |
const serviceAccount = require("./account_key.json"); | |
// Lightweight JavaScript date library for parsing, validating, | |
// manipulating, and formatting dates. | |
const moment = require('moment'); | |
// Serpwow module | |
const SerpWow = require('google-search-results-serpwow'); |
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
// Create the serpwow object, passing in our API key | |
const serpwow = new SerpWow(API_KEY); | |
// Initialize the default app | |
admin.initializeApp({ | |
credential: admin.credential.cert(serviceAccount), | |
databaseURL: "https://APP_ID.firebaseio.com" | |
}); | |
// Minimum time period(i.e. 'from') search parameter |
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
// The function scheduled to run every 12 hours | |
exports.scheduledFunction = functions.pubsub.schedule('every 12 hours').onRun(async (context) => { | |
// retrieve the search results as JSON | |
await serpwow.json(params) | |
.then(result => { | |
// Articles Firestore CollectionReference | |
const articlesRef = admin.firestore().collection('articles'); | |
// Save search results to Firestore | |
const articles = result["news_results"] |
OlderNewer