This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| [RequireComponent(typeof(PolygonCollider2D))] | |
| [RequireComponent(typeof(MeshFilter))] | |
| [RequireComponent(typeof(MeshRenderer))] | |
| [RequireComponent(typeof(LineRenderer))] | |
| public class MeshFromPolygonCollider2D : MonoBehaviour | |
| { | |
| // Based onh ttp://answers.unity3d.com/questions/835675/how-to-fill-polygon-collider-with-a-solid-color.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * @example | |
| * | |
| * const red = (text) => <span style={{ backgroundColor: 'red', color: 'white', padding: '8px' }}>{text}</span>; | |
| * | |
| * return ( | |
| * <> | |
| * {jsxt`Displaying some ${red('red text')} here`} | |
| * </> | |
| * ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { useState } from 'react'; | |
| import { z } from 'zod'; | |
| import reactLogo from './assets/react.svg'; | |
| import './App.css'; | |
| import { useZodForm, register } from './useZodForm'; | |
| type ObjectKey = keyof any; | |
| type Field<N extends ObjectKey, V> = { | |
| name: N; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // @ts-check | |
| const { execSync } = require('child_process'); | |
| const { ESLintUtils, AST_NODE_TYPES } = require('@typescript-eslint/utils'); | |
| /** @type {Record<string, { exportName: string, usedInModule: boolean }[]>} */ | |
| let cache; | |
| const loadUnusedExports = () => { | |
| if (!cache) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // @ts-check | |
| const { execSync } = require('child_process'); | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| const { parse } = require('@typescript-eslint/parser'); | |
| const eslintRc = require('../.eslintrc.js'); | |
| const unusedExportsByFilename = execSync('ts-prune') | |
| .toString() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // @ts-check | |
| /** @type {import('@typescript-eslint/utils').TSESLint.RuleModule} */ | |
| module.exports = { | |
| meta: { | |
| docs: { | |
| description: | |
| "See [TypeScript Enums are TERRIBLE. Here's Why. - Michigan TypeScript](https://www.youtube.com/watch?v=0fTdCSH_QEU)", | |
| }, | |
| type: 'suggestion', | |
| fixable: 'code', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function complement<A, T extends A>(predicate: (arg: A) => arg is T): (arg: A) => arg is Exclude<A, T>; | |
| function complement<A extends any[]>(predicate: (...args: A) => boolean) { | |
| return (...args: A) => !predicate(...args); | |
| } | |
| function isUndefined<A>(anything: A | undefined): anything is undefined; | |
| function isUndefined(anything: any): anything is undefined { | |
| return anything === undefined | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const isCapitalized = (str) => str[0] === str[0].toUpperCase(); | |
| const reportPropsError = (componentName, node, context, sourceCode) => { | |
| const newPropsName = `${componentName}Props`; | |
| const allPropsIdentifierTokens = sourceCode.ast.tokens.filter( | |
| (token) => token.type === 'Identifier' && token.value === 'Props' | |
| ); | |
| context.report({ | |
| node, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // global.d.ts | |
| declare global { | |
| // eslint-disable-next-line @typescript-eslint/ban-types | |
| type EmptyObject = Record<string, never>; | |
| } | |
| // .eslintrc.js | |
| '@typescript-eslint/ban-types': [ | |
| 2, | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require('fs'); | |
| const packageLockJson = require('./package-lock.json'); | |
| const packageJson = require('./package.json'); | |
| const compareVersions = (ver1, ver2) => { | |
| const v1 = ver1.split('.'); | |
| const v2 = ver2.split('.'); | |
| return v1.some((v, i) => Number(v) > Number(v2[i])); |