Skip to content

Instantly share code, notes, and snippets.

View raveesh-me's full-sized avatar
🦁
Honesty, Humility, Patience, Pride.

Raveesh Agarwal raveesh-me

🦁
Honesty, Humility, Patience, Pride.
View GitHub Profile
@raveesh-me
raveesh-me / [ListView ~vh~ adapter] DayAdapter.kt
Last active October 21, 2017 12:41
An performance optimized ListView adapter without viewHolder implementation.
package com.example.raveesh.stormy.adapters
import android.content.Context
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import com.example.raveesh.stormy.R
import com.example.raveesh.stormy.weather.Day
import kotlinx.android.synthetic.main.daily_list_item.view.*
import org.jetbrains.anko.imageResource
@raveesh-me
raveesh-me / RequestPermissions
Created October 27, 2017 23:04
A kotlin/anko template for a RequestPermission workflow
package `in`.cookytech.testapp
import android.Manifest
import android.Manifest.permission
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.support.v7.app.AppCompatActivity
import org.jetbrains.anko.*
import org.jetbrains.anko.sdk25.coroutines.onClick
new AlertDialog.Builder(MainActivity.this)
.setTitle("Call Permission")
.setMessage("Hi there! We can't call anyone without the call permission, could you please grant it?")
.setPositiveButton("Yep", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
})
.setNegativeButton("No thanks", new DialogInterface.OnClickListener() {
List<Recipe> categoryListGenerator(iCategory) {
List<Recipe> _categoryRecipe = recipes.where((recipe) {
return recipe.category == iCategory;
}).toList();
return _categoryRecipe;
}
List<Recipe> recipes = [
new Recipe(
"Pesto Pastry",
@raveesh-me
raveesh-me / main.dart
Created July 7, 2018 00:22
An inherited callback pattern to change InheritedWidget state in flutter
import 'package:flutter/material.dart';
import 'package:flutter_login_manager/splash_screen.dart';
import 'package:flutter_login_manager/model/login_info.dart';
import 'package:flutter_login_manager/model/login.dart' as loginManager;
import 'package:flutter_login_manager/home_screen.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
@raveesh-me
raveesh-me / introrx.md
Created August 28, 2018 05:25 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@raveesh-me
raveesh-me / user_info_manager.dart
Last active September 20, 2018 07:57
UserInfoManager InheritedWidget
class UserInfoManager extends InheritedWidget {
final Key key;
final ManagedUserInfo managedUserInfo;
final Widget child;
final Function() refreshManagedUserInfo;
UserInfoManager(
{@required this.managedUserInfo,
@required this.child,
@required this.setManagedUserInfo,
import 'dart:async';
import 'dart:core';
import 'package:flutter_ritetag/model/client.dart';
import 'package:flutter_ritetag/network/network_calls.dart';
import 'package:meta/meta.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'user_info.dart';
void main() {
var anda = [1, 2, 3, 4, 5, 6, 7, 8, 9];
var divisibleByTwo = (int i) {
return i % 2 == 0;
};
var greaterThanThree = (int i) {
return i > 3;
};
@raveesh-me
raveesh-me / main.dart
Created February 22, 2020 13:33
Multiple Futures
void main() async {
List<String> strings = [
'jgjjhga',
'tyuyua',
'afghf',
'dsfsd',
'trrt',
'zxczx',
'a',
'asd',