Skip to content

Instantly share code, notes, and snippets.

View aneurysmjs's full-sized avatar
💭
асинхорнный

Аневризма aneurysmjs

💭
асинхорнный
View GitHub Profile

solve ERR_PNPM_BAD_PM_VERSION

discussion

message

ERR_PNPM_BAD_PM_VERSION  This project is configured to use v9.1.1 of pnpm. Your current pnpm is v9.0.4

If you want to bypass this version check, you can set the "package-manager-strict" configuration to "false" or set the "COREPACK_ENABLE_STRICT" environment variable to "0"

solution

@aneurysmjs
aneurysmjs / playground.vue
Created May 19, 2024 23:08
some vue stuff
// @see https://play.vuejs.org/#eNqVVluPm0YU/isTVMmsYkPq9sli0bbpVm2lJlUTtQ/GDwQGmwRmyDB417L47znnzAwXb+IkfjGcy3e+Obfh7P3SNMGx497Gi9pMlY1mVSr2t4mn28RjLdddEyeirBupNDszxYsle0h1drB/90XBM71kgj/qt2X2gfWsULJmCwBdJGJw/a2r69PvUtVWHYSDBOODqTV8rQ9czQwHiTVMRCZFq1nd7tktMvIXf/Cqkux/qar82eJmYrB2FoWUoyKTndBW8wKkTi66urViwR/YG679mxEtbV6N+i1hBMe06vhuAlGf/k6bCQa8Ra1WpdhDjrr6HVfbXexvt4u0qhZLtn2x2+0wRiKKTmS6lIIdUpFX/GUF2fRv2DkRzBA2wZ4/R0EYElkjCtI89ycmAMcmamDjTrMNgmBULKe4eIgeeaTtSWTsgg0cY0bo6/FnFt9OgRwpiRYbWtC3ybIVGII8tbZx4J3iTHG4gCrw1r8xUS4yCqIZOgARwFQ252rCfyk46eDn6jwDAl/UmbahI6QPaQntZ2fIhyzfxkOirwYh/bU4ZDBktscHW+jLEsucV/+hn0/eG2b61lYchmlgQP8WhbaAjxVdsglvnAZZ8aCSe39Bc5VBmD3PcQqRhfOks33Z1czTE99ERKHZV7Cd4EXzuqlSzeGNsejwY3w+037o+yiEN7B4tlpBIkg97qIaz7yi48DKAwfYeXddkwPSZq67zBEYhjFbrSigCapAYio6EliPDEA87rbjiuA39WkafU2o9nwWLzqsY5gbAFkTCOBiOntIPiC+67SGCt5lOJwDTRrVxIthLqPQmJg0TTBxMRlMXF3Q1xuApoe+B1xjaNsJVfZxUDoTy4nqdJWUWyFPeEXhpHreEm4e6ICi3AfvWyngYqKmSLxM1k1ZcfW6waaF2wlYmUFKPGh++fAXybSCSXXy7MCzD5+Rv28fUZZ4/yjecnWEcg46nao910Z9/+YVzORECVXrKrC+
@aneurysmjs
aneurysmjs / Foo.tsx
Last active May 9, 2024 08:58
Artificially slow down a component
function Foo() {
const now = performance.now();
/**
* The result of the first performance.now() call (stored in now) is subtracted from the current time.
* This effectively calculates the time elapsed since the loop began.
*
* the loop keeps running as long as it hasn't been a full second since the startTime was captured.
* Once the elapsed time hits or goes above 200ms, the loop condition becomes false, and the loop terminates.
*/
@aneurysmjs
aneurysmjs / someHook.tsx
Last active May 9, 2024 11:56
some considerations when using useEffect
useEffect(() => {
// componentDidMount ?
}, []);
useEffect(() => {
// componentDidUpdate ?
}, [foo, bar]);
useEffect(() => {
return () => {
describe('useQueryProductById', () => {
afterEach(() => {
jest.clearAllMocks();
});
it('should return a single product', async () => {
const product = {
id: 2,
title: 'Mens Casual Premium Slim Fit T-Shirts ',
price: 22.3,
@aneurysmjs
aneurysmjs / conditionals.sh
Last active July 23, 2023 11:38
some basic bash
num=10
# -eq equals
# -ne not equal
# -gt greather than
# -ge greather than or equal
# -lt less than
# -le less than or equal
if [ $num -eq 10]
/**
<template>
<div id="foo" @click="handleClick">Yo!</div>
</template>
*/
import {
createElementVNode as _createElementVNode,
openBlock as _openBlock,
createElementBlock as _createElementBlock,
@aneurysmjs
aneurysmjs / jscodeshift-scope-methods.js
Last active December 18, 2022 22:07
Jscodeshift's scope methods
// getScope() is a method provided by jscodeshift that can be used to get the Scope object for a given Node.
// A Scope object represents the lexical scope of a node in the abstract syntax tree (AST).
// It contains information about the variables, functions, and other declarations that are in scope at a given point in the code.
// Here's an example of how getScope() can be used:
import { getScope } from 'jscodeshift';
const source = `
function foo() {
@aneurysmjs
aneurysmjs / generics.rs
Last active November 10, 2022 00:12
Generics in Rust
struct Point<T, U> {
x: T,
y: U,
}
impl<T, U> Point<T, U> {
// Methods that use different generic types than their struct’s definition
fn mixup<V, W>(self, other: Point<V, W>) -> Point<T, W> {
Point {
x: self.x,
@aneurysmjs
aneurysmjs / rust_cheat_sheet.rs
Created November 9, 2022 15:49
Rust cheatsheet
// represents the `possible` absence of a value
enum Option<T> {
Some(T),
None,
}
let email: Option<String> = Some(email_str);
let email: Option<String> = None;
// representsan operation that could have failed