Skip to content

Instantly share code, notes, and snippets.

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

Robert S. codeBelt

💭
I may be slow to respond.
View GitHub Profile
@ghosh
ghosh / micromodal.css
Last active April 14, 2025 16:32
Demo modal styles for micromodal.js and corresponding expected html. If using this, set the `awaitCloseAnimation` in config to true
/**************************\
Basic Modal Styles
\**************************/
.modal {
font-family: -apple-system,BlinkMacSystemFont,avenir next,avenir,helvetica neue,helvetica,ubuntu,roboto,noto,segoe ui,arial,sans-serif;
}
.modal__overlay {
position: fixed;
@jcalz
jcalz / tuple.md
Last active March 1, 2024 03:33
TypeScript tuple inference

You can use the tuple() function in tuple.ts to infer tuple types in TypeScript and cut down on the need to repeat yourself. Without tuple(), declaring a constant of a tuple type looks like this:

const daysOfTheWeek: ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"] = 
  ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];

You can't do this:

const daysOfTheWeek = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"]; 
@novascreen
novascreen / README.md
Last active November 18, 2021 08:11
How to mock next/router in Storybook

If you use Storybook with Next.js and have components using next/link you'll have to mock next/router the same you would for testing with Jest or others. Simply create a file with the mock router as shown below and import it in your Storybook config.

This is based on some information from an issue on Next.js:

vercel/next.js#1827

import { OnDestroy } from '@angular/core';
import { Subject } from 'rxjs/Subject';
export abstract class BaseComponent implements OnDestroy {
protected destroyed$: Subject<boolean> = new Subject();
protected constructor() {}
ngOnDestroy(): void {
@kitze
kitze / store-wrapper.js
Last active April 28, 2022 13:45
mobx store wrapper for storybook
import React from 'react';
import {Provider} from 'mobx-react';
const stub = () => true;
export const exampleStore = {
app: {},
auth: {
checkAuth: stub
},
@JackNUMBER
JackNUMBER / currencyPattern.js
Created March 2, 2017 17:06
Get Currency Symbol Position
// this script return the currency symbol position (before/after) depending of the locale
const getCurrencySymbolPosition = function (locale, currency) {
let currencyString = new Intl.NumberFormat(locale, {
style: "currency",
currency: currency,
currencyDisplay: "code"
}).format(99); // number doesn't matter here
if (currencyString.slice(0, 3) == currency) {
@chranderson
chranderson / nvmCommands.js
Last active April 24, 2025 18:42
Useful NVM commands
// check version
node -v || node --version
// list locally installed versions of node
nvm ls
// list remove available versions of node
nvm ls-remote
// install specific version of node
@ffoodd
ffoodd / improved-sr-only.markdown
Last active March 21, 2025 09:26
Improved .sr-only

Improved .visually-hidden

Theorically bulletproof CSS class for visually hide anything and keep it accessible to ATs.

A Pen by ffoodd on CodePen.

License.

@bbenezech
bbenezech / BootstrapField.tsx
Last active August 23, 2017 04:56
redux-form 6 with typescript. Trigger warnings: no semi, multiline comma dangle
import * as React from 'react'
import { Field, WrappedFieldProps } from 'redux-form'
export interface OwnProps {
name: string,
type?: string,
label?: string,
help?: string,
}
@karlpokus
karlpokus / npm_link.md
Last active July 13, 2022 15:32
npm link for dummies