Skip to content

Instantly share code, notes, and snippets.

View ultraon's full-sized avatar

Vitalii ultraon

View GitHub Profile
@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 / build.gradle
Last active August 19, 2020 18:10
Good example of the merged Jacoco code covarage Gradle configuration
apply plugin: 'com.android.application'
apply from: "$rootDir/coverage.gradle"
//...
android {
//...
buildTypes {
//...
debug {
@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 / 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 / IoToMainThreadTransformers.java
Last active June 2, 2017 13:10
The {@link IoToMainThreadTransformers} is a factory of convenient Rx transformers to use with {@link io.reactivex.Observable#compose(ObservableTransformer)} operator to transform observable via apply {@link io.reactivex.Observable#subscribeOn(Scheduler)} operator with the {@link Schedulers#io()} and {@link io.reactivex.Observable#observeOn(Sche…
/**
* The {@link IoToMainThreadTransformers} is a factory of convenient Rx transformers to use with {@link
* io.reactivex.Observable#compose(ObservableTransformer)} operator to transform observable via
* apply {@link io.reactivex.Observable#subscribeOn(Scheduler)} operator with the {@link
* Schedulers#io()} and {@link io.reactivex.Observable#observeOn(Scheduler)} operator with the
* {@link AndroidSchedulers#mainThread()}.
*/
public final class IoToMainThreadTransformers {
private IoToMainThreadTransformers() {
@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 / 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 / RuntimeTypeAdapterFactory.java
Last active May 23, 2017 18:54
RuntimeTypeAdapterFactory with fixed issue: com.google.gson.JsonParseException
/*
* Copyright (C) 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ultraon
ultraon / bash-cheatsheet.sh
Created March 17, 2017 11:02 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@ultraon
ultraon / reset_routing_table.sh
Created March 6, 2017 10:39 — forked from midwire/reset_routing_table.sh
Reset routing table on OSX
#!/usr/bin/env bash
# Reset routing table on OSX
# display current routing table
echo "********** BEFORE ****************************************"
netstat -r
echo "**********************************************************"
for i in {0..4}; do
sudo route -n flush # several times