This file contains 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 { 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, |
This file contains 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 { 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'; |
This file contains 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 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()) |
This file contains 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-nocheck | |
export default ({ error: { message: error }, render: Render }) => ( | |
<div> | |
<h3>Error: {error}</h3> | |
<Render error /> | |
</div> | |
); |
This file contains 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
// 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.
This file contains 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 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); | |
}; |
This file contains 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
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'; |
NewerOlder