Skip to content

Instantly share code, notes, and snippets.

View TheLittleNaruto's full-sized avatar
🎯
Focusing

TheLittleNaruto TheLittleNaruto

🎯
Focusing
View GitHub Profile
@year_api_blueprint.route('/all')
@app.app_context()
@cache.cached(timeout=500, key_prefix="years")
# @requires_login - this need to be public
def get_all_years():
data = Database.find("years", {})
if data is not None:
return jsonify([year for year in data])
@TheLittleNaruto
TheLittleNaruto / CustomToast.kt
Last active July 21, 2020 09:26
Custom Toast Helper
/*
* Copyright (C) 2019 @author TheLittleNaruto
*
* 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
$ adb logcat ActivityManager:S LocationManager:S *:V
$ adb logcat -s ActivityManager:V
$ adb logcat > log_to_be_shared.txt
$ adb shell setprop log.tag.MainActivity DEBUG
$ adb logcat -s MainActivity:V
05–13 22:54:51.539 2885 11072 I MainActivity: MainActivity=> onCreate()
$ adb logcat -s *:V #Verbose filter
$ adb logcat -s *:D #Debug filter
$ adb logcat -s *:I #Info filter
$ adb logcat -s *:W #Warning filter
$ adb logcat -s *:E #Error filter
$adb devices
List of devices attached
192.168.1.5:5555 device
$ adb tcpip 5555
$ adb connect <Mobile Device IP Address>:5555
# Example:
$ adb connect 192.168.1.5:5555
@TheLittleNaruto
TheLittleNaruto / MainActivity.kt
Created May 13, 2020 17:19
Example on Logging for Medium article blog on Logging and debugging
class MainActivity : AppCompatActivity() {
companion object {
val TAG = MainActivity::class.java.simpleName
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "$TAG=> onCreate()")
}