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
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);
};
@fernandocamargo
fernandocamargo / README.md
Last active May 27, 2022 09:39
Report builder - request/response sample

Request

{
  "columns": [
    {
      "type": "month",
      "values": ["01", "02", "03", "04", "05"]
    },
    "itemtype"
  ],
export const fail = (reason) => Promise.resolve({ status: 'failed', reason });
export const skip = (unresolvedDependencies) =>
Promise.resolve({ status: 'skipped', unresolvedDependencies });
export const succeed = (value) =>
Promise.resolve({ status: 'resolved', value });
export const categorize = (stack, [id, { status, value }]) => {
const type = status === 'resolved' ? status : 'unresolved';