Skip to content

Instantly share code, notes, and snippets.

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

Аневризма aneurysmjs

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

NORMAL mode

navigation

h left
j down
k up
l right

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
Last active May 31, 2024 11:52
some vue stuff
// @see https://play.vuejs.org/#eNqtV19zm0YQ/yoXpjNCEwmlap9UrHHruNNmpnamTtMHoQcMh0QCB4VDtkaj797dvTs4sCwnk/hFsLf7273982N9cH4tS2/XcGfh+HVUpaVkWSg2F4Ej68BhNZdNuQxEmpdFJdmBVTyZsIdQRlv9c50kPJITJvij/JBGnyesqflVXX8Mq5odWVIVORuBg1EgWpi3TZ7vfy+qXB97s1aCsYCqVryVW171FFtJX/EOfjPe0+xEWjUQUSFqyfJ6wy7wIu7oD55lBfu3qLL41WhsKcyNRlIU3UFUNELqkzcgNXLR5LUWC/7A7rh0xx1aWN505yvC8HZh1vC1BZHv/wpLCwPe/FpWqdhAapv8nler9dJdrUZhlo0mbPVmvV6jj0AkjYhkWgi2DUWc8asMiuCO2SEQTAWsnL1+jYLZjIJVIi+MY9dSAThmHUM05jYrz/O6g4mNi5c4YhxhvRcRG0QD1+gF9LL/nsaXh0CGlESNDZ3r6mTpCrROnmprP/BOfmwcLqAKvHbHyssgoyDqoQMQAdiyfqzK/XPO6Qz+TJ17QGCLZ6pt6ArhQ5hC++nRcyHLF8s20Wed0Pk5P6TQZvaID7rQwxIXMc8+op1L1gum+lZXHIapjYB+NQqRh4sVnTArbpyGIuNeVmzcEc1VBG42PMYpxCiMJd3teVM1T09s1bABQ1VvQxnqeSNrlC3YaDTBF56HaYZvxm5w539A+a65z1Ppop26as8/iiGvdErlMj7bZKBA5yIQ/kyRL1AtvEgO1BVKDm+M+dsfl4cDsdbx6M/gDTReTadQHjruyDTHSkwJH/gbDIDAL5syBqRF/2xYOVCcLdl0Sg6V0wokqs+6AOZdBCDuyHk3JfhFvre9zwn1FJqiZoa2HZxF4RoPYEzWXrhJVw/tkxDLSmWQMQj/3d3tjac6M032VDYERnbNsgmbj+FuZDVTZlQITLMJ3t/Ol0BEEPCcUAET+1Nb3TdSQntcRsh2bVzE
@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,