Skip to content

Instantly share code, notes, and snippets.

View fernandocamargo's full-sized avatar
💀
I am the beast I worship

Fernando Camargo Del Buono fernandocamargo

💀
I am the beast I worship
View GitHub Profile
@fernandocamargo
fernandocamargo / e2e.md
Last active August 29, 2025 13:01
Playwright + Cucumber custom DSL

🔹 Atoms

import { Page, Locator } from "playwright";

export type Atom = (page: Page, label: string) => Locator;

export const field: Atom = (page, label) =>
  page.getByLabel(label);

export const button: Atom = (page, label) =>
import { Suspense, createElement, forwardRef, lazy } from 'react';
import { css } from '@/tools/emotion';
export const enhance = ([{ default: render }, { default: style }]) => {
const className = css({ name: render.hash }, style);
const component = (props, ref) =>
createElement(forwardRef(Object.assign(render, { displayName: '✨' })), {
...props,
className,
import { cwd } from 'process';
import { dirname, parse, relative } from 'path';
import { fileURLToPath, URL } from 'url';
import { existsSync } from 'fs';
import { pascalCase } from 'pascal-case';
import { config } from 'dotenv';
import { minimatch } from 'minimatch';
import { transformSync as compile } from '@swc/core';
import { Visitor } from '@swc/core/Visitor';
import { defineConfig } from 'vite';
const delay = () => (Math.floor(Math.random() * 6) + 1) * 1000;
const callback1 = () =>
new Promise((resolve) =>
setTimeout(() => resolve(console.log({ callback: 1 })), delay())
);
const callback2 = () =>
new Promise((resolve) =>
setTimeout(() => resolve(console.log({ callback: 2 })), delay())
// @ts-nocheck
export default ({ error: { message: error }, render: Render }) => (
<div>
<h3>Error: {error}</h3>
<Render error />
</div>
);
// Feb 21, 2016, 4:31 AM
// I have no idea why I wrote this
console.clear();
var identities = [];
var identity = function () {
var symbol = '█████';
var color = (this.color || '#000');
var repeated = (identities.indexOf(color) >= 0);

Implement a compression algorithm that will count letters, e.g. coooooobalt => c6xobalt (or: 1xc6xo1xb1xa1xl1xt) stttartuuuup => s3xtart4xup (or: 1xs3xt1xa1xr1xt4xu1xp)

Use the language/technology you feel strong in.

import get from "lodash/get";
import isFunction from "lodash/isFunction";
import setWith from "lodash/setWith";
import updateWith from "lodash/updateWith";
export const apply = (source, [path, value]) => {
const handle = isFunction(value) ? updateWith : setWith;
return handle(source, path, value, Object);
};