Skip to content

Instantly share code, notes, and snippets.

@crutch12
crutch12 / TypedRest.ts
Last active December 22, 2023 21:34
Msw.js Rest class typed with Taxios scheme (msw@1)
// @NOTE: ONLY msw@1 (!)
// msw@2 is not supported
import { MockedResponse, ResponseComposition, rest, RestContext, RestRequest } from 'msw';
import { DefaultRequestBody, ResponseResolver } from 'msw/lib/types/handlers/RequestHandler';
import { PathParams } from 'msw/lib/types/utils/matching/matchRequestUrl';
import qs from 'qs';
import { ConditionalPick } from 'type-fest';
import urljoin from 'url-join';
/**
@crutch12
crutch12 / .prettierrc.js
Last active June 17, 2024 19:26
Prettier Config
module.exports = {
printWidth: 120,
tabWidth: 2,
useTabs: false,
semi: true,
singleQuote: true,
quoteProps: 'consistent',
trailingComma: 'all',
bracketSpacing: true,
arrowParens: 'always',
@crutch12
crutch12 / .stylelintrc.js
Created April 16, 2022 23:41
Stylelint scss config
module.exports = {
plugins: ['stylelint-scss'],
extends: 'stylelint-config-standard',
rules: {
// @NOTE: This conflicts with @use from scss
'at-rule-no-unknown': null,
'scss/at-rule-no-unknown': true,
// @NOTE: This conflicts with styled-components
'no-empty-source': null,
@crutch12
crutch12 / .stylelintrc.styled-components.js
Created April 16, 2022 23:43
Stylelint styled-components config
// @NOTE: https://github.com/styled-components/stylelint-processor-styled-components/issues/187#issuecomment-396687345
module.exports = {
processors: ['stylelint-processor-styled-components'],
extends: ['stylelint-config-standard', 'stylelint-config-styled-components'],
rules: {
indentation: 2,
// @NOTE: This conflicts with @use from scss
'at-rule-no-unknown': null,
'scss/at-rule-no-unknown': true,
@crutch12
crutch12 / branchNameLint.js
Created April 16, 2022 23:45
Branch name lint config (+ .husky/pre-push hook file)
// eslint-disable-next-line @typescript-eslint/no-var-requires
const branchNameLint = require('@web-bee-ru/branch-name-lint');
// See: https://github.com/barzik/branch-name-lint#options
const options = {
prefixes: ['feature', 'hotfix', 'release'],
suggestions: {
features: 'feature',
feat: 'feature',
fix: 'hotfix',
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://tempuri.org/PurchaseOrderSchema.xsd"
targetNamespace="http://tempuri.org/PurchaseOrderSchema.xsd"
elementFormDefault="qualified">
<xsd:element name="PurchaseOrder" type="tns:PurchaseOrderType"/>
<xsd:complexType name="PurchaseOrderType">
<xsd:sequence>
<xsd:element name="ShipTo" type="tns:USAddress" maxOccurs="2"/>
<xsd:element name="BillTo" type="tns:USAddress"/>
</xsd:sequence>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://some/awesome/schema">
<xs:element name="REQUEST">
<xs:complexType>
<xs:sequence>
<xs:element name="LOGIN">
<xs:complexType>
<xs:choice>
<xs:element name="API_TOKEN">
<xs:annotation>
const execSync = require('child_process').execSync;
const fs = require('fs');
const webpack = require('webpack');
const marked = require('marked');
module.exports = (env, argv) => {
return {
plugins: [
// @NOTE: Generate CHANGELOG.md (from git log + current CHANGELOG.md), put it in bundle
env.NODE_ENV === 'production' && {
@crutch12
crutch12 / AbilityContext.ts
Created May 13, 2022 13:42
Setup React Casl ability (src/components/ability)
import React from 'react';
import { defineAbilitiesFor } from '~/lib/ability';
export const AbilityContext = React.createContext(defineAbilitiesFor(null));
@crutch12
crutch12 / README.md
Last active July 14, 2022 15:15
Smartgit ui config

Help - About Smartgit - Information - Setting Path (click) - Go to latest (eg. 21.2) - Copy/Paste .yml files from this gist - Done