Skip to content

Instantly share code, notes, and snippets.

View proteye's full-sized avatar
🏠
Working from home

Ramil Zaynetdinov proteye

🏠
Working from home
View GitHub Profile
@proteye
proteye / inherited_model_sample.dart
Created August 28, 2024 16:40 — forked from PlugFox/inherited_model_sample.dart
SettingsScope with InheritedModel
/*
* https://gist.github.com/PlugFox/320d051c5a393f56f60c3cf080d6171a
* https://dartpad.dev/320d051c5a393f56f60c3cf080d6171a?null_safety=true
*/
import 'package:flutter/widgets.dart';
@immutable
class SettingsScope extends StatefulWidget {
final Widget child;
@proteye
proteye / check_internet_connection.dart
Created July 18, 2024 13:10
Check internet connection on Flutter
import 'dart:developer' as developer;
import 'dart:io';
const _lookupHost = 'example.com';
/// Web servers to check.
const _hosts = [
'example.com',
'ya.ru',
'google.com',
@proteye
proteye / bitwarden_passwords_fix.js
Created June 29, 2024 12:17
Fix names of Bitwarden passwords
const fs = require("fs");
const url = require("url");
function fixBitwardenJson() {
const filePath = process.argv[2];
if (!filePath || !fs.existsSync(filePath)) return;
let jsonData = null;
let count = 0;
@proteye
proteye / custom_tooltip.dart
Last active October 27, 2023 11:30
Custom animated Tooltip on Flutter
import 'package:flutter/material.dart';
class CustomTooltip extends StatefulWidget {
final String message;
final Widget child;
const CustomTooltip({Key key, this.child, @required this.message})
: super(key: key);
@override
@proteye
proteye / allways_scrollable_with_keep_position_scroll_physics.dart
Created September 22, 2023 12:51
AllwaysScrollableWithKeepPositionScrollPhysics - allways scrollable with keep position scroll physics in Flutter
import 'package:flutter/material.dart';
class AllwaysScrollableWithKeepPositionScrollPhysics extends ScrollPhysics {
final double? Function(double)? _onGetScrollPosition;
const AllwaysScrollableWithKeepPositionScrollPhysics(
{ScrollPhysics? parent, double? Function(double)? onGetScrollPosition})
: _onGetScrollPosition = onGetScrollPosition,
super(parent: parent);
@proteye
proteye / single_child_with_keep_position_scroll_view.dart
Last active September 22, 2023 12:30
SingleChildWithKeepPositionScrollView - single child with keep position scroll view in Flutter
import 'dart:math' as math;
import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
class SingleChildWithKeepPositionScrollView extends StatelessWidget {
/// Creates a box in which a single widget can be scrolled.
const SingleChildWithKeepPositionScrollView({
super.key,
@proteye
proteye / KeystoneImageUploader.tsx
Last active August 15, 2024 22:19
Image uploading in KeystoneJS document editor
/** @jsxRuntime classic */
/** @jsx jsx */
import { jsx } from '@keystone-ui/core'
import { FC } from 'react'
import styles from './styles'
import { IImageUploaderProps } from './types'
import useBase from './useBase'
export const ImageUploader: FC<IImageUploaderProps> = (props) => {
@proteye
proteye / scrollbar_visible_always.css
Created May 30, 2019 08:23
Always display the scrollbar - both on mobile devices and macOS
#customScroll::-webkit-scrollbar { width: 4px; height: 4px;}
#customScroll::-webkit-scrollbar-track { background-color: #999;}
#customScroll::-webkit-scrollbar-track-piece { background-color: #ffffff;}
#customScroll::-webkit-scrollbar-thumb { height: 50px; background-color: #666; border-radius: 3px;}
#customScroll::-webkit-scrollbar-corner { background-color: #999;}
#customScroll::-webkit-resizer { background-color: #666;}
@proteye
proteye / aes_encryption_helper.dart
Created September 5, 2018 10:54
How to AES-256 (CBC/CFB mode) encrypt and decrypt in Dart/Flutter with Pointy Castle
import 'dart:convert';
import 'dart:typed_data';
import "package:pointycastle/export.dart";
import "./convert_helper.dart";
// AES key size
const KEY_SIZE = 32; // 32 byte key for AES-256
const ITERATION_COUNT = 1000;
package aeslib
import (
"bytes"
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"crypto/sha256"
"encoding/base64"
"errors"