Skip to content

Instantly share code, notes, and snippets.

View ultraon's full-sized avatar

Vitalii ultraon

View GitHub Profile
@ultraon
ultraon / StateHandler.java
Last active May 24, 2017 11:36
Special class that can handle {@link Runnable} actions that started after {@link android.app.Activity#onPause()}, in this case state handler remembers all actions and starts them after {@link android.app.Activity#onResume()}. All methods should be called from UI thread otherwise an exception will be thrown. This class has very convenient usage w…
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import io.reactivex.functions.Consumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.LinkedList;
import java.util.Queue;
@ultraon
ultraon / build.gradle.txt
Last active May 24, 2017 14:10
Adds support for splitted Apkes by abi (arch platform), creates renameApk task (supports the android.split feature), see https://developer.android.com/studio/build/gradle-tips.html
apply plugin: 'com.android.application'
//...
//Adds support for splitted Apkes by abi (arch platform)
android {
//...
splits {
// Configures multiple APKs based on ABI.
abi {
@ultraon
ultraon / IoUtils.java
Created May 25, 2017 21:37
Utils for I/O operations
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import okhttp3.internal.io.FileSystem;
import okio.BufferedSource;
import okio.Okio;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@ultraon
ultraon / LabeledStreamLogHandler.swift
Last active December 15, 2019 20:15
Extended logger for swift-log library (https://github.com/apple/swift-log)
//
// LabeledStreamLogHandler.swift
// WishBag
//
// Created by ultraon on 15/12/19.
// Copyright © 2019 ultraon. All rights reserved.
//
import Foundation
import Logging
@ultraon
ultraon / main.dart
Last active January 23, 2024 19:47
How to use OverlayPortal
import 'package:flutter/material.dart';
/// Flutter code sample for [OverlayPortal].
void main() => runApp(const OverlayPortalExampleApp());
class OverlayPortalExampleApp extends StatelessWidget {
const OverlayPortalExampleApp({super.key});
@override
@ultraon
ultraon / demo.dart
Created December 2, 2024 21:20
The sample shows that the const widget can be skipped by Flutter for rebuilding.
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class DemoPage extends StatelessWidget {
const DemoPage({super.key});
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (ctx) => DependentCounterCubit(),
@ultraon
ultraon / cursor_ide_rules_for_flutter.txt
Created March 4, 2025 21:53
Cursor IDE rules for Flutter development
You are a senior Dart programmer with experience in the Flutter framework and a preference for clean programming and design patterns.
Generate code, corrections, and refactorings that comply with the basic principles and nomenclature.
## Dart General Guidelines
### Basic Principles
- Use English for all code and documentation.
- Always declare the type of each variable and function (parameters and return value).