Skip to content

Instantly share code, notes, and snippets.

View vemarav's full-sized avatar
👨‍💻
Productive

Aravind Vemula vemarav

👨‍💻
Productive
View GitHub Profile
@vemarav
vemarav / ceres-solver-android.md
Last active February 18, 2024 08:38
Generate ceres-solver libceres.so for android

STEP 1

git clone https://ceres-solver.googlesource.com/ceres-solver

STEP 2

cd ceres-solver
@vemarav
vemarav / page_route_builder.dart
Last active November 13, 2023 17:37
Flutter Navigation Fade Transition
Navigator.of(context).push(
new PageRouteBuilder(
pageBuilder: (BuildContext context, _, __) {
return new Notes();
},
transitionsBuilder: (_, Animation<double> animation, __, Widget child) {
return new FadeTransition(
opacity: animation,
child: child
);
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
import React, {useState} from 'react';
import {Alert, Clipboard, View, ViewStyle} from 'react-native';
import FastImage, {ResizeMode} from 'react-native-fast-image';
import Video, {VideoProperties} from 'react-native-video';
import {InView} from 'react-native-intersection-observer';
import {useNavigation} from '@react-navigation/native';
export interface VideoBGProps
extends Omit<VideoProperties, 'source' | 'src' | 'resizeMode'> {
imgURL: string;
@vemarav
vemarav / laber_form.dart
Last active December 3, 2022 14:11
Flutter 2: Dynamic Drawer List, Stateful Widgets, Forms and Validation.
import 'package:flutter/material.dart';
import 'package:keeper/views/mock_data.dart';
class LabelForm extends StatefulWidget {
static final String routeName = '/labelForm';
@override
State<StatefulWidget> createState() => new LabelFormState();
}
@vemarav
vemarav / todo_stateful.dart
Created May 2, 2022 12:33
todo list app using stateful widget
import 'package:flutter/material.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
// bloc & get packages
// behind
void main() {
runApp(MyApp());
// expects to receive a widget and mount it as a root widget
@vemarav
vemarav / intro_to.dart
Created May 1, 2022 03:45
introduction to dart
// import 'dart:async';
// import 'dart:math';
// every dart program starts with main function
void main() {
// basic data types
// 1. bool
// 2. int
// 3. double
@vemarav
vemarav / text.dart
Last active April 16, 2022 06:33
Flutter text scale animation
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
static const String _title = 'Flutter Code Sample';
@override
@vemarav
vemarav / auth_utils.dart
Last active March 9, 2022 13:23
Flutter Authentication Fllow
import 'package:shared_preferences/shared_preferences.dart';
class AuthUtils {
static final String endPoint = '/api/v1/auth_user';
// Keys to store and fetch data from SharedPreferences
static final String authTokenKey = 'auth_token';
static final String userIdKey = 'user_id';
static final String nameKey = 'name';
@vemarav
vemarav / scrollview_vs_flatlist_vs_recycler_list_view.md
Last active August 9, 2021 11:36
Comparison of react native ScrollView vs FlatList vs RecyclerListView

Memory consumed by FlatList and RecyclerListView is similar, RecyclerListView wins over UI glitches as for large data sets glitches may observed in FlatList

No ScrollView FlatList RecyclerListView
1 No Memory Management Automatic Memory Management Automatic Memory Management (Similar to FlatList)
2 Loads All content at once Loads content as window scrolled Loads content as window scrolled
3 Scroll position is not preserved if data refreshed Scroll position is not preserved if data refreshed Scroll is preserved if data refreshed
4 Observable frame drops Observable frame drops for large data sets (> 1500) No frame drops, Highly Performant
5 Trouble refreshing data Trouble refreshing data Easy to refresh/update data
6 Available in react native import {ScrollView} from 'react-native' Available in react native import {FlatList} from 'react-native' Available via third-party module ` import { RecyclerListView, DataProvider, LayoutProvider } from "r