Beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app. This approach streamlines the app install process, since the user does not need to grant permissions when they install or update the app. It also gives the user more control over the app's functionality; for example, a user could choose to give a camera app access to the camera but not to the device location. The user can revoke the permissions at any time, by going to the app's Settings screen.
This file contains 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
package com.yourco.yourapp; | |
import java.util.ArrayList; | |
import java.util.List; | |
import android.content.Context; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.BaseAdapter; |
This file contains 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
<?php | |
/* | |
A simple cache for remote files/URLs | |
2011 Carlo Alberto Ferraris <cafxx@strayorange.com> | |
=================================================== | |
The cache function allows you to get the contents of a remote URL at | |
most once every N seconds. It also supports the If-Modified-Since HTTP | |
header to avoid fetching the resource again if it hasn't changed. |
This file contains 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
package com.nextstagesearch; | |
import android.Manifest; | |
import android.app.Activity; | |
import android.app.AlertDialog; | |
import android.content.Context; | |
import android.content.ContextWrapper; | |
import android.content.DialogInterface; | |
import android.content.pm.PackageManager; |
This file contains 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.graphics.Color; | |
import android.os.Bundle; | |
import android.support.v4.widget.SwipeRefreshLayout; | |
import android.support.v7.widget.DefaultItemAnimator; | |
import android.support.v7.widget.LinearLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
import com.togethernetworks.basesdk.BaseActivity; | |
import com.togethernetworks.gallery.samples.mortar.UiModule; |
This file contains 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
#!/bin/bash | |
checkExisting(){ | |
echo "Checking if already existing device on file..." | |
while read fileLine; do | |
if [ "$line" = "$fileLine" ]; then | |
echo "[WARNING] Device already initialized on this system. Nothing to do here" |
This file contains 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 numpy as np | |
import multiprocessing as multi | |
def chunks(n, page_list): | |
"""Splits the list into n chunks""" | |
return np.array_split(page_list,n) | |
cpus = multi.cpu_count() | |
workers = [] | |
page_list = ['www.website.com/page1.html', 'www.website.com/page2.html' |
This file contains 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 ViewModelFactory @Inject constructor( | |
private val providers: Map<Class<out ViewModel>, @JvmSuppressWildcards Provider<ViewModel>> | |
) : ViewModelProvider.Factory { | |
override fun <T : ViewModel> create(modelClass: Class<T>): T { | |
val provider = providers[modelClass] | |
?: providers.asIterable().find { modelClass.isAssignableFrom(it.key) }?.value | |
?: error("Unknown ViewModel class $modelClass") | |
return try { |
This file contains 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
/** | |
* Инфлейт ViewBinding заданного типа [T]. | |
* | |
* В качестве родителя используется [ViewGroup], по умолчанию view прикрепляется к корню родителя. | |
* **ВАЖНО!** Для инфлейта вьюх с `merge` в корне нужно использовать только этот метод. | |
*/ | |
inline fun <reified T : ViewBinding> ViewGroup.inflateViewBinding( | |
context: Context = this.context, | |
attachToRoot: Boolean = true | |
): T { |
This file contains 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
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
import time | |
class InstagramBot(): | |
def __init__(self, email, password): | |
self.browserProfile = webdriver.ChromeOptions() | |
self.browserProfile.add_experimental_option('prefs', {'intl.accept_languages': 'en,en_US'}) | |
self.browser = webdriver.Chrome('chromedriver.exe', chrome_options=self.browserProfile) | |
self.email = email |
OlderNewer