Skip to content

Instantly share code, notes, and snippets.

View koderhun's full-sized avatar
💙
React development

Ramil koderhun

💙
React development
  • 22:18 (UTC -12:00)
View GitHub Profile
@koderhun
koderhun / header scroll fixed
Created January 17, 2020 14:04
Фиксация header при обратной прокрутке.
$(window).on("scroll", function() {
var fromTop = $(document).scrollTop();
if (docPos > fromTop) {
$body.toggleClass("header-fix", fromTop > 20);
} else {
$body.removeClass("header-fix");
}
if (fromTop > 105) {
@koderhun
koderhun / config-overrides.js
Created February 5, 2020 09:28
Less config for CRA and Ant Design
const rewireLess = require('react-app-rewire-less');
module.exports = function override(config, env) {
config = rewireLess.withLoaderOptions({
javascriptEnabled: true,
})(config, env);
return config;
};
@koderhun
koderhun / type.js
Created February 25, 2020 04:10 — forked from ufocoder/type.js
function type(value) {
var regex = /^\[object (\S+?)\]$/;
var matches = Object.prototype.toString.call(value).match(regex) || [];
return (matches[1] || 'undefined').toLowerCase();
}
@koderhun
koderhun / useDebounce.js
Created November 7, 2022 06:47
Задержка для выполнения запроса на сервер. Чтобы не перегружать слишком частыми запросами при вводе данных в поле.
import { useEffect, useState } from 'react'
export const useDebounce = (value, delay) => {
const [debounced, setDebounced] = useState(value)
useEffect(() => {
const handler = setTimeout(() => setDebounced(value), delay)
return () => clearTimeout(handler)
}, [value, delay])
@koderhun
koderhun / useActions.js
Created November 7, 2022 10:58
useActions для redux-toolkit
// hooks для того чтобы не импортировать в каждый компонент redux dispath
// можно просто импортировать этот файл и брать доступные экшаны
import { useDispatch } from 'react-redux'
import { bindActionCreators } from 'redux'
import { githubActions } from '../store/github/github.slice'
// список доступных экшенов
const actions = {
...githubActions,
@koderhun
koderhun / grub.conf
Last active March 6, 2024 07:09
my grub config /etc/default/grub
# /etc/default/grub
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=3
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_BACKGROUND="/files/pictures/mars.jpg"
GRUB_GFXMODE=640x480
@koderhun
koderhun / .bushrc.sh
Last active February 22, 2024 17:25
Настройки git в самом корне домашней папки
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
@koderhun
koderhun / .gitconfig
Last active July 13, 2023 13:34
Корневой конфиг для git
[user]
name = Ramil
email = example@gmail.com
[core]
editor = nano
[init]
defaultBranch = main
@koderhun
koderhun / remove-android-system-app.sh
Last active January 13, 2024 05:38
Удаление системных приложений из xiaomi или другого android
# установка на ubuntu
# sudo apt install android-tools-adb
# из форума
# https://forum.xda-developers.com/t/guide-debloat-remove-stock-apps-without-root.3935438/
# https://forum.xda-developers.com/t/guide-to-disable-oem-bloatware-aka-system-apps-using-adb-and-fastboot-method-no-root-thread-updated-on-16-08-2021.3779873/
# adb shell pm uninstall -k --user 0 com.miui.home # лаунчер. Если удалить то надо заранее поставить другой и настроить
# adb shell pm uninstall -k --user 0 com.oppo.launcher # Стоковый лаунчер OPPO (важно перед этим нужно установить сторонний).
@koderhun
koderhun / bash.sh
Last active January 9, 2024 08:36
Swapfile enable in ubuntu system
# https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-20-04
sudo fallocate -l 10G /swapfile &&
sudo chmod 600 /swapfile &&
sudo mkswap /swapfile &&
sudo cp /etc/fstab /etc/fstab.bak &&
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab /swapfile none swap sw 0 0