Skip to content

Instantly share code, notes, and snippets.

View anatooly's full-sized avatar

Anatolii B anatooly

View GitHub Profile
@anatooly
anatooly / .vimrc
Created February 10, 2021 16:32
2021 vimrc
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
set expandtab
set number
set nowrap
set showbreak=+++
set textwidth=100
set showmatch
set visualbell
set hlsearch
{
"editor.cursorStyle": "line-thin",
"editor.fontFamily": "'SF Mono', Menlo, Monaco, 'Courier New', monospace",
"editor.fontLigatures": true,
"editor.fontSize": 13,
"editor.fontWeight": "500",
"editor.lineHeight": 17,
"terminal.integrated.fontSize": 12,
"terminal.integrated.lineHeight": 1.23,
"editor.minimap.enabled": false,
{
// Place your settings in this file to overwrite the default settings
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.detectIndentation": true,
"editor.lightbulb.enabled": false,
"editor.fontFamily": "'Dank Mono', Menlo, Monaco, 'Courier New', monospace",
"editor.fontLigatures": false,
"editor.rulers": [80],
"editor.snippetSuggestions": "top",
{
"Create React.FC typescript component RN/Relay fragment": {
"scope": "javascript,typescript",
"prefix": "#react-fc",
"body": [
"import React from 'react'",
"import { StyleSheet, View, Text } from 'react-native'",
"import { graphql, useFragment } from 'react-relay/hooks'",
"import { ${TM_FILENAME_BASE}_data$$key } from '__generated__/${TM_FILENAME_BASE}_data.graphql'",
"",
@anatooly
anatooly / react-app-auth.js
Created August 30, 2021 12:27
kentcdodds.com react app auth
// @doc https://codesandbox.io/s/react-app-auth-bc99t?fontsize=14&hidenavigation=1&theme=dark&file=/src/original.js:0-1988
import React from 'react'
const sleep = time => new Promise(resolve => setTimeout(resolve, time))
const getUser = () => sleep(1000).then(() => ({username: 'elmo'}))
// .then(() => null)
const AuthContext = React.createContext()
function AuthProvider({children}) {
@anatooly
anatooly / addon.contentscript.js
Created October 15, 2021 11:52 — forked from kucheruk/addon.contentscript.js
ATI.su morpheus gist.
//content script = ship, feature component = morpheus.
console.log("Morpheus injected");
const features = new Map();
function messageToMorpheus(msg) {
window.postMessage({ direction: "from-ship", message: msg }, "*");
}
chrome.runtime.onMessage.addListener((msg, _, sendResponse) => {
@anatooly
anatooly / gist:502618ee6b73b9946350ea83b07db084
Created February 17, 2022 14:47
Git push code to dev (origin/master) & customer repo (customer/main)
git remote add customer [email protected]:anatooly/test.git
git co -b main <Initial commit>
git merge --squash master
git commit -m <Commit text>
git push customer
or
rsync -rv --exclude=.git --exclude=node_modules --exclude=.next dev-dir/ customer-dir
manual commit & push from customer-dir
@anatooly
anatooly / pre-commit
Created August 12, 2022 09:40
pre-commit
#!/bin/bash
#
# Pre-commit hooks
# Check branch name
BRANCH_NAME_LENGTH=`git rev-parse --abbrev-ref HEAD | grep -E '^(?!((fix|feature)\/[a-zA-Z0-9\-]+)$).*' | wc -c`
if [ ${BRANCH_NAME_LENGTH} -eq 0 ] ; then
echo -e '\E[37;44m'"\033[1mERROR\033[0m in pre-commit hook: vim .git/hooks/pre-commit"
echo "Branch name should be like feature/lowerUpper09-EXY-134 - brand is two letters"