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
import java.util.concurrent.Executor; | |
public class ExecutorsSample { | |
public static void main(String[] args) { | |
// Executor executor = new Executor() { | |
// @Override | |
// public void execute(Runnable command) { | |
// command.run(); | |
// } | |
// }; |
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
import java.util.concurrent.Executor; | |
public class ExecutorsSample { | |
public static void main(String[] args) { | |
// Executor executor = new Executor() { | |
// @Override | |
// public void execute(Runnable command) { | |
// command.run(); | |
// } | |
// }; |
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
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.atomic.AtomicInteger; | |
import java.util.concurrent.locks.ReentrantLock; | |
public class Main { | |
public static void main(String[] args) { | |
// BankAccount account = new BankAccount(); | |
// Thread t1 = new Thread(() -> account.withdraw(80), "Person-1"); | |
// Thread t2 = new Thread(() -> account.withdraw(80), "Person-2"); |
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
DOM(https://youtu.be/ipkjfvl40s0) - Document Object Model | |
object as a tree structure | |
DOM is an object-oriented representation of web page | |
Component(https://youtu.be/16rQyEQtpyQ?list=PLC3y8-rFHvwhBRAgFinJR8KHIrCdTkZcZ): | |
Template(view/HTML) + Class(code/typescript/data&methods) + Metadata(information decorator) | |
3 ways of declaring selector | |
1 -> selector: 'app-badwords' -> <app-badwords></app-badwords> in html file |
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
// https://youtu.be/VWlwkqmTLHc?list=PLQkwcJG4YTCQcFEPuYGuv54nYai_lwil_ | |
// USING TRY-CATCH FOR EXCEPTION HANDLING | |
// wrong | |
lifecycleScope.launch { | |
try { | |
launch { | |
throw Exception("failed") | |
} | |
} catch (e: Exception) { | |
} |
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 DummyActivity : AppCompatActivity(R.layout.activity_dummy) { | |
private val btn by lazy { | |
findViewById<Button>(R.id.btn) | |
} | |
private val tv by lazy { | |
findViewById<TextView>(R.id.tv) | |
} | |
var aToFragCallback: ActivityToFragCallBack<String>? = null |
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
// exploring funcs & props usage in gradle file | |
// below code is placed in app/build.gradle | |
// executed tasks as `$ ./gradlew showMagics` | |
// https://medium.com/@dmitriileonov/5-gradle-things-that-get-android-developers-confused-ed606b8e8c92 | |
class Foo { | |
def name = "" | |
void name(String newString) { | |
name = newString | |
println "Foo.name() triggered: name: $newString" |
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
package com.bhnetwork.scanit.consumer | |
import kotlinx.coroutines.* | |
import kotlin.random.Random | |
// mistake 1 - getFirstName call happens one after another | |
suspend fun getUserFirstNames(userIds: List<String>): List<String> { | |
val firstNames = mutableListOf<String>() | |
userIds.forEach { | |
firstNames.add(getFirstName(it)) |
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"?> | |
<ripple xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:color="@color/black_10" | |
tools:targetApi="lollipop"><!-- ripple effect color --> | |
<!-- background color --> | |
<item android:id="@android:id/background"> | |
<shape android:shape="rectangle"> | |
<solid android:color="@android:color/transparent" /> |
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 DynamicHomeFragment : Fragment() { | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
val color2 = requireActivity().application.resources.getColor(R.color.your_special_color, null) // returns Color.GREEN | |
binding.content.ll3.setBackgroundColor(color2) | |
} | |
} |
NewerOlder