Skip to content

Instantly share code, notes, and snippets.

View kshirsagarps's full-sized avatar

Pratyush Kshirsagar kshirsagarps

View GitHub Profile
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.usample"
{
"Vegetarian": [
{
"id": 10,
"name": "Vegan Veggie",
"price": "23.95",
"menu_description": "Daiya vegan mozzarella, paired with fresh veggies",
"classifications": {
"vegetarian": true
},
class Solution {
public boolean isMatch(String s, String p) {
if (s == null || p == null) return false;
// Create Table and fill default value for edge case
int n = s.length(), m = p.length();
boolean[][] table = new boolean[n+1][m+1];
table[n][m] = true;
for(int i= m-1; i>=0; i--){
@kshirsagarps
kshirsagarps / Calculate Sum Three Distinct Int
Last active March 6, 2019 22:59
Calculate sum of three distinct integers to match the integer values in the total.
/**
* Problem: given numbers with distinct int values such that:
* abc
* + abc
* + abc
* --------
* ccc
*
* Find a, b & c.
*
@kshirsagarps
kshirsagarps / TpCloseScope.java
Created September 6, 2018 17:27
TP Close Scope
Toothpick.closeScope(activity);
@kshirsagarps
kshirsagarps / TPBinding.java
Created September 6, 2018 17:26
Install TP Binding
scope.installModules(Module().apply { bind(State::class.java).toInstance(State(0)) });
@kshirsagarps
kshirsagarps / TPOpenScope.java
Last active September 6, 2018 17:26
TP Binding and Scope Creation
val scope = Toothpick.openScopes(application, activity);
@kshirsagarps
kshirsagarps / TPOpenScope.java
Created September 6, 2018 17:23
TP Binding and Scope Creation
val scope = Toothpick.openScopes(application, activity);
@kshirsagarps
kshirsagarps / TPScope.java
Created September 6, 2018 17:20
TP Scope and Injection
class MyActivity {
@Inject lateinit var state: State
onCreate(...) {
super.onCreate()
scope = ...
ToothPick.inject(this, scope);
}
}
class SimpleActivity : AppCompatActivity() {
private var store = Store(0)
private val subscriptions = CompositeSubscription()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_counter)
setTitle(R.string.simple_activity_name)