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
def trans(m): | |
numRows = len(m) | |
numCols = len(m[0]) | |
tMatrix = [[0 for x in range(numRows)] for y in range(numCols)] | |
for i in range(0,numCols): | |
for j in range(0,numRows): | |
tMatrix[i][j] = m[j][i] | |
return tMatrix | |
print(trans([[1,3,5],[2,4,6]])) |
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
. - Any Character Except New Line | |
\d - Digit (0-9) | |
\D - Not a Digit (0-9) | |
\w - Word Character (a-z, A-Z, 0-9, _) | |
\W - Not a Word Character | |
\s - Whitespace (space, tab, newline) | |
\S - Not Whitespace (space, tab, newline) | |
\b - Word Boundary |
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
//Utils - Declaration | |
object PromptUtils { | |
fun alertDialog(context: Context, @StyleRes style: Int, dialogBuilder: AlertDialog.Builder.() -> Unit): Dialog { | |
val builder = AlertDialog.Builder(context, style).also { | |
it.setCancelable(false) | |
it.dialogBuilder() | |
} | |
return builder.create() | |
} |
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
<androidx.appcompat.widget.LinearLayoutCompat 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/bottom_sheet" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:orientation="vertical" | |
app:behavior_hideable="true" | |
app:behavior_peekHeight="0dp" | |
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior" |
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 ch8n.project.magniffect.main.home | |
import android.app.Activity | |
import android.content.Context | |
import android.content.Intent | |
import android.graphics.Bitmap | |
import android.graphics.PixelFormat | |
import android.hardware.display.DisplayManager | |
import android.hardware.display.VirtualDisplay | |
import android.media.ImageReader |
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
<!--In style.xml --> | |
<style name="CustomDialog" parent="Theme.AppCompat.Light.Dialog.Alert"> | |
<item name="colorAccent">@color/accent_color</item> | |
<item name="android:windowMinWidthMajor">@dimen/dialog_min_width_major</item> | |
<item name="android:windowMinWidthMinor">@dimen/dialog_min_width_minor</item> | |
<item name="android:windowBackground">@color/transparent</item> | |
</style> | |
<!--In dimesn.xml --> |
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 Single private constructor(){ | |
companion object{ | |
@Volatile private var instance: Single? = null | |
fun getInstance() = instance?: synchronized(lock=this){ | |
instance?: Single().also{ | |
instance = it | |
} | |
} | |
} |
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
onClick(view:view) = when(view.id){ | |
R.id.button_action1->actionOneClicked() | |
R.id.button_action2->actionTwoClicked() | |
R.id.button_action3->TODO("action 3 is work in progress!") | |
} |
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
if(Date().after(date)){ | |
TODO("Has to complted before : $date") | |
} |
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
fun SAFE_TODO(reason:String){ | |
if (BuildConfig.DEBUG) { | |
TODO(reason) | |
}else{ | |
Toast.makeText(context,"NOT_IMPLEMENYTED:$reason",Toast.LENGTH_SHORT).show() | |
} | |
} |
OlderNewer