Skip to content

Instantly share code, notes, and snippets.

View radist2s's full-sized avatar

Alex Batalov radist2s

  • Georgia, Tbilisi
  • 02:20 (UTC +04:00)
View GitHub Profile
@radist2s
radist2s / docusaurus.config.js
Last active March 17, 2024 19:14
Adds `npx` and `npm exec --call` support to `@docusaurus/remark-plugin-npm2yarn` plugin.
{
// ...
docs: {
remarkPlugins: [
[
require('@docusaurus/remark-plugin-npm2yarn'),
{
sync: true,
converters: [
[
@radist2s
radist2s / git-clean-tree.md
Created October 10, 2023 12:01
Рекомендации по использованию Git для поддержания чистоты дерева изменений

Amend Commit

git commit --amend -m "New commit message"

Эта команда позволяет изменить сообщение последнего коммита на "New commit message".

🧹 Перезапись хеша: Поскольку содержание коммита изменяется (хотя бы сообщение), хеш коммита тоже изменится. Это, в свою очередь, приведёт к изменению хешей всех последующих коммитов, если таковые имеются.

@radist2s
radist2s / MessagesProvider.tsx
Created August 18, 2023 01:14
Next.js Dynamic I18nProvider with chunked LinguiJS messages
import { Messages, setupI18n } from '@lingui/core';
import { I18nProvider } from '@lingui/react';
import { ReactNode, useState } from 'react';
export const generateMessagesProvider = async (
locale: string,
{ messages }: { messages: Messages }
) => {
return function LocaleMessagesProvider({ children }: { children: ReactNode }) {
return (
@radist2s
radist2s / Docker Machine Virtual Network creating issue fix.md
Created April 2, 2022 01:36
Docker Machine Virtual Network creating issue fix

Docker Machine Virtual Network creating issue fix

Error: VBoxManage: error: Code E_ACCESSDENIED (0x80070005) - Access denied (extended info not available)

  • Create file path /etc/vbox/networks.conf
  • Put the entry * 0.0.0.0/0 ::/0 (including leading star)
  • Profit!

Answer source

@radist2s
radist2s / Remove-zsh-history-entry.md
Created April 1, 2022 18:22
Remove zsh history entry

Remove zsh history entry

*BSD/Darwin (macOS):

LC_ALL=C sed -i '' '/porn/d' $HISTFILE

Linux (GNU sed):

@radist2s
radist2s / docker-machine-cheatsheet.md
Last active December 18, 2020 11:39
docker-machine cheatsheet

Retrieving mahine configuration

docker-machine config

Executing Docker command

docker \
-H=tcp://192.168.1.1:2376 \
--tlsverify \
@radist2s
radist2s / .gitignore
Created April 15, 2020 19:18
IDEA PhpStorm .gitignore file
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
@radist2s
radist2s / Custom_WP_Image_Editor_GD.php
Created February 24, 2020 19:41
Wordpress custom GD editor with `fill_background` ability to fill PNG alpha with color fill
<?php
class Custom_WP_Image_Editor_GD extends WP_Image_Editor_GD {
/**
* @param array $rgb
*
* @return false|resource
*/
public function fill_background( $rgb ) {
$width = $this->size['width'];
$height = $this->size['height'];
@radist2s
radist2s / react-load-script.d.ts
Created November 6, 2019 15:39
react-load-script TypeScript definition
declare module 'react-load-script' {
import {Component} from 'react'
export interface ILoadScriptProps {
url: string
onCreate?: () => void
onError?: () => void
onLoad?: () => void
}
@radist2s
radist2s / remove_class_filter.php
Created August 6, 2019 17:04
Remove WordPress class to method filter from third party plugin `remove_class_filter`
<?php
// Found on https://wpforthewin.com/remove-hook-from-class-based-wp-plugin/
/**
* Make sure the function does not exist before defining it
*/
if (!function_exists('remove_class_filter')) {
/**
* Remove Class Filter Without Access to Class Object
*