Skip to content

Instantly share code, notes, and snippets.

View shawn-sandy's full-sized avatar
💭
I may be slow to respond.

Shawn Sandy shawn-sandy

💭
I may be slow to respond.
View GitHub Profile
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@shawn-sandy
shawn-sandy / Button.js
Last active March 11, 2024 13:38
React snippets
import React from 'react'
const Button = (props) => {
const { className, children, ...rest } = props
return (
<button className={className} {...rest}>
{children}
</button>
)
}
@shawn-sandy
shawn-sandy / pixesl-to-rem.js
Last active January 15, 2024 21:08
script-kit
// Name: Pixels to Rem
/*
# Pixels to rems converter
- This script converts pixels to rems and copies the result to the clipboard
- It uses the entered base/root font size to calculate the conversion
- The default root font size is 16px
## Author: @shawnsandy
.divider {
position: relative;
text-align: center;
/* padding-bottom: 20px; adjust as needed */
height: 16px; /* adjust as needed */
}
.divider span {
background-color: #FFF;
padding: 0 10px;
@shawn-sandy
shawn-sandy / commit.js
Created November 25, 2023 12:14
cli tools
import inquirer from "inquirer";
import { exec } from "child_process";
// Define the questions
const questions = [
{
type: "list",
name: "type",
message: "Select the type of change that you're committing:",
choices: ["feat", "fix", "docs", "style", "refactor", "test", "chore"],
@shawn-sandy
shawn-sandy / BaseTheme.js
Last active October 30, 2023 03:19
storybook
// .storybook/FirstPaint.js
import { create } from '@storybook/theming'
export default create({
base: 'light',
brandTitle: 'FPKIT',
brandUrl: '/',
brandImage:
'https://res.cloudinary.com/dqjs95c7n/image/upload/v1647385126/fp-text-logo-sm_efd59g.svg',
@shawn-sandy
shawn-sandy / associative-array.ts
Last active September 2, 2023 19:46
typescript
// create a javascript type for and associative array
type AssocArray = {
[key: string]: string;
};
// use the type to create an associative array
const myArray: AssocArray = {
"key1": "value1",
"key2": "value2",
@shawn-sandy
shawn-sandy / README.md
Last active June 2, 2023 21:06
Starters

Documented starters/setups guides for building frontend applications

const nextJest = require('next/jest')
const createJestConfig = nextJest({
// Provide the path to your Next.js app to load next.config.js and .env files in your test environment
dir: './',
})
// Add any custom config to be passed to Jest
const customJestConfig = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
@shawn-sandy
shawn-sandy / App.test.tsx
Last active April 1, 2023 19:12
ViteReact
import { describe, expect, it } from 'vitest'
import App from './App'
import { render, screen, userEvent } from './utils/test-utils'
describe('Simple working test', () => {
it('the title is visible', () => {
render(<App />)
expect(screen.getByText(/Hello Vite \+ React!/i)).toBeInTheDocument()
})