Skip to content

Instantly share code, notes, and snippets.

View jesselima's full-sized avatar
📱
Coding for mobile...

Jesse Lima jesselima

📱
Coding for mobile...
View GitHub Profile
@gildor
gildor / OnViewWithTimeout.kt
Last active March 17, 2022 02:29
Simple implementation of Android Espresso onView with timeout
import android.view.View
import androidx.test.espresso.Espresso
import androidx.test.espresso.NoMatchingViewException
import androidx.test.espresso.ViewAssertion
import androidx.test.espresso.ViewInteraction
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.Visibility
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
import org.hamcrest.Matcher
@alana-mullen
alana-mullen / ConnectivityExtension.kt
Created January 16, 2020 00:28
Android Kotlin extension to check network connectivity
import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkCapabilities
import android.os.Build
val Context.isConnected: Boolean
get() {
val connectivityManager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
return when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> {
@codediodeio
codediodeio / config.js
Last active April 16, 2024 04:46
Snippets from the Firestore Data Modeling Course
import * as firebase from 'firebase/app';
import 'firebase/firestore';
var firebaseConfig = {
// your firebase credentials
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
@jacobaraujo7
jacobaraujo7 / maps.dart
Created April 4, 2019 23:39
maps.dart
import "dart:io";
List<Map<String,dynamic>> cadastros = [];
main(){
bool condicao = true;
print("\x1B[2J\x1B[0;0H");
while (condicao) {
print("==== DIGITE UM COMANDO");
@jacobaraujo7
jacobaraujo7 / imc.dart
Created April 4, 2019 23:31
Cálculo de imac
import 'dart:io';
main() {
calculoImc();
}
//Programa que calcula o imc
calculoImc() {
print("=== Digite seu Peso");
String textPeso = stdin.readLineSync();
@psteiger
psteiger / android-kotlin-location-extensions.kt
Last active April 14, 2023 12:28
Location-related Kotlin extension functions for Android.
// Location-related Kotlin extension properties for Android.
// They must be implemented in an Activity because Geocoder needs a context.
// Or else, they must be turned from extension properties to extension functions that receive a context as parameter.
// Example of use
// Use case: show the user his locality name on a TextView
val userLocation = Location(someLatitude, someLongitude)
launch(UI) {
aTextView.text = userLocation.localityName.await()
@CodingDoug
CodingDoug / README.md
Last active November 6, 2022 09:29
Example code from the video "Use async/await with TypeScript in Cloud Functions"

Example code from the video "Use async/await with TypeScript in Cloud Functions"

This is the example code from my video about using async/await with Cloud Functions. I've placed it here in a gist so it's easier to compare the "before" and "after" states for each case.

Watch the video here

The code in this project is licensed under the Apache License 2.0.

Copyright 2018 Google LLC
@maltebucksch
maltebucksch / DeveloperTeamTest.kt
Last active August 19, 2022 18:32
Evaluating a great developer team
fun testTeamIsAwesome() {
val quickBirdTeamMembers = fetchTeamMembers()
val awesomeTeamMembers = quickBirdTeamMembers.filter { teamMember ->
teamMember.isPassionate &&
teamMember.isFriendly &&
teamMember.isConstantlyImproving
}
assertEquals(quickBirdTeamMembers.size, awesomeTeamMembers.size)
@ArthurNagy
ArthurNagy / RoundedBottomSheetDialogFragment.kt
Last active May 10, 2024 09:22
Rounded modal bottom sheet as seen in new Google products(Tasks, News, etc.), described in this article: https://medium.com/halcyon-mobile/implementing-googles-refreshed-modal-bottom-sheet-4e76cb5de65b
package com.your.package
import android.app.Dialog
import android.os.Bundle
import com.your.package.R
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
/**
* BottomSheetDialog fragment that uses a custom
@florina-muntenescu
florina-muntenescu / CustomTypefaceSpan.kt
Last active November 16, 2023 19:39
Style internationalized text using Annotations
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software