Skip to content

Instantly share code, notes, and snippets.

View iliyaZelenko's full-sized avatar
😌
Calm

Илья iliyaZelenko

😌
Calm
View GitHub Profile
@iliyaZelenko
iliyaZelenko / DioRefreshTokenInterceptor.dart
Created February 7, 2024 20:56
DioRefreshTokenInterceptor
import 'dart:io';
import 'package:dio/dio.dart';
import '../app_http_client.dart';
import '../app_http_client_token_refresher.dart';
import '../app_http_exception.dart';
import '../http_method.dart';
// TODO Ilya: lock all requests while refreshing token
@iliyaZelenko
iliyaZelenko / flutter_icons_generator.py
Last active April 21, 2022 14:17
Flutter svg icons generator to dart files with docs
import os
import re
# Relatively to "lib"
dartIconsPath = 'resources/icons/'
iconsDirectory = 'assets/icons/'
# Change string to lowerCamelCase
def to_camel(word):
class MyClass {}
void main() {
const className = MyClass;
print(className());
}
@iliyaZelenko
iliyaZelenko / _breakpoints.sass
Created July 31, 2019 18:28
Bootstrap media mixins (.sass)
// Breakpoint viewport sizes and media queries.
//
// Breakpoints are defined as a map of (name: minimum width), order from small to large:
//
// (xs: 0, sm: 576px, md: 768px, lg: 992px, xl: 1200px)
//
// The map defined in the `$grid-breakpoints` global variable is used as the `$breakpoints` argument by default.
// Name of the next breakpoint, or null for the last breakpoint.
//
@iliyaZelenko
iliyaZelenko / swipe.js
Created December 30, 2018 14:11
An example of using swipe on mobile devices.
// at least 100 px are a swipe
// you can use the value relative to screen size: window.innerWidth * .1
const offset = 100;
let xDown, yDown
window.addEventListener('touchstart', e => {
const firstTouch = getTouch(e);
xDown = firstTouch.clientX;
yDown = firstTouch.clientY;
(89.99999999999999 !== 90.00000000000000) !== (89.999999999999999 !== 90.000000000000000)
@iliyaZelenko
iliyaZelenko / getSrcDir.js
Last active December 1, 2018 19:23
Find source (src) or another folder path going up the Hierarchy.
const { join } = require('path')
export function getSrcDir (srcFolder = 'src', startPath = __dirname) {
const parentPath = normalize(startPath + '/..')
if (startPath === parentPath) {
throw Error('Could not find folder.')
}
if (basename(startPath) === srcFolder) {
@iliyaZelenko
iliyaZelenko / timezones.json
Created October 19, 2018 02:30
All world timezones with countries codes and offsets.
{"data":
[{"name":"Africa/Conakry","countryCode":"GIN","offset":"(UTC+00:00)","offsetPrefix":"+"},{"name":"Africa/Lome","countryCode":"TGO","offset":"(UTC+00:00)","offsetPrefix":"+"},{"name":"Atlantic/Reykjavik","countryCode":"ISL","offset":"(UTC+00:00)","offsetPrefix":"+"},{"name":"Africa/Monrovia","countryCode":"LBR","offset":"(UTC+00:00)","offsetPrefix":"+"},{"name":"America/Scoresbysund","countryCode":"GRL","offset":"(UTC+00:00)","offsetPrefix":"+"},{"name":"America/Danmarkshavn","countryCode":"GRL","offset":"(UTC+00:00)","offsetPrefix":"+"},{"name":"Africa/Bissau","countryCode":"GNB","offset":"(UTC+00:00)","offsetPrefix":"+"},{"name":"Africa/Banjul","countryCode":"GMB","offset":"(UTC+00:00)","offsetPrefix":"+"},{"name":"Africa/Bamako","countryCode":"MLI","offset":"(UTC+00:00)","offsetPrefix":"+"},{"name":"Africa/Dakar","countryCode":"SEN","offset":"(UTC+00:00)","offsetPrefix":"+"},{"name":"Africa/Ouagadougou","countryCode":"BFA","offset":"(UTC+00:00)","offsetPrefix":"+"},{"name":"Africa/Accra","countryCo
@iliyaZelenko
iliyaZelenko / set environment variable.ps1
Last active September 4, 2018 21:47
PowerShell SetEnvironmentVariable
[Environment]::SetEnvironmentVariable("<VARIABLE_NAME>", "<VARIABLE_VALUE>", "User")
@iliyaZelenko
iliyaZelenko / all-words.js
Created August 27, 2018 19:06
Find all words in text(regular expression)
function getWords (text) {
return text.match(/([^\u0000-\u0040\u005B-\u0060\u007B-\u00BF\u02B0-\u036F\u00D7\u00F7\u2000-\u2BFF])+/g)
}
// Example:
// For text: 'Есть button, h1, textarea. Мне нужно: найти самое длинное слово в-textarea! то -- что пишу в ней'.match(...)
// Result will be: ["Есть", "button", "h", "textarea", "Мне", "нужно", "найти", "самое", "длинное", "слово", "в", "textarea", "то", "что", "пишу", "в", "ней"]
// AUTOR: https://regexr.com/3b0ik