Skip to content

Instantly share code, notes, and snippets.

View DattatreyaReddy's full-sized avatar
🎯
Focusing

Padya DattatreyaReddy

🎯
Focusing
View GitHub Profile
abstract class Utils {
/**
* The compose method composes a function operation with the provided value.
* <br/>
* It applies the operation to the value if the value is not null and returns the result.
*/
public static <V, R> R compose(V value, Function<V, R> operation) {
if (Objects.isNull(value) || Objects.isNull(operation)) {
@DattatreyaReddy
DattatreyaReddy / gh_pr.sh
Last active January 29, 2025 14:03
get pull request review comments and files
#!/bin/bash
# Exit on error
set -e
# Ensure PR number is provided
if [ -z "$1" ]; then
echo "Usage: $0 <PR_NUMBER>"
exit 1
fi
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.tabbyml.scheduler</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/tabby</string>
<string>scheduler</string>
@DattatreyaReddy
DattatreyaReddy / shared_preferences_client.dart
Last active November 18, 2024 23:47
Riverpod state persistence with Shared Preference
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../../constants/db_keys.dart';
import '../../../controllers/common_controllers.dart';
import '../../extensions/custom_extensions.dart';
@DattatreyaReddy
DattatreyaReddy / dio_client.dart
Last active April 29, 2025 03:58
DIo Client is a wrapper around Dio to support decoder with Compute (Threads)
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'dio_error_util.dart';
typedef ResponseDecoderCallBack<DecoderType> = DecoderType Function(dynamic);
class DioClient {
final Dio dio;
DioClient(this.dio);