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
Developer setup guid | |
https://www.stuartellis.name/articles/mac-setup/ | |
# Install Xcode | |
xcode-select --install | |
# Install and update Homebrew | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" |
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
// ./account_key.json | |
// https://console.firebase.google.com/u/1/project/project_id/settings/serviceaccounts/adminsdk | |
// Google recommends using Secret Manager to store API keys, passwords, certificates, and other sensitive data. | |
{ | |
"type": "service_account", | |
"project_id": "...", | |
"private_key_id": "...", | |
"private_key": "...", | |
"client_email": "...", | |
"client_id": "...", |
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"] |
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
// 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
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
<?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 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"?> | |
<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"> |
NewerOlder