Skip to content

Instantly share code, notes, and snippets.

Paul dagda1

Block or report user

Report or block dagda1

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View foo.ts
interface Foo {
value?: string;
}
const item1: Foo = { value: 'foo' }
// ERROR: Object is possibly 'undefined'.
console.log(`Message ${item1.value.substring(4)}`);
const item2 = { value: 'foo' }
View analyse.js
process.env.NODE_ENV = 'production';
const webpack = require('webpack');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const webpackConfigProd = require('react-scripts/config/webpack.config')('production');
// this one is optional, just for better feedback on build
const chalk = require('chalk');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const green = text => {
View tsconfig.json
"exclude": [
"src/**/*.test.ts",
"src/**/*.test.tsx"
]
View Heagaon.ts
export enum HexagonType {
flat = 'flat',
pointy = 'pointy'
}
View tailwind.css
<button class="bg-blue hover:bg-blue-dark text-white font-bold py-2 px-4 rounded">
Button
</button
View gist:94a91f0fbb7a86f541be142543bc0255
$spacing: 0.625; // 4px
$unit: rem;
$spacing-x1: #{$spacing}#{$unit} !important;
$spacing-x2: #{$spacing * 2}#{$unit} !important;
$spacing-x3: #{$spacing * 3}#{$unit} !important;
$spacing-x4: #{$spacing * 4}#{$unit} !important;
$spacing-x5: #{$spacing * 5}#{$unit} !important;
$spacing-x6: #{$spacing * 6}#{$unit} !important;
$spacing-x7: #{$spacing * 7}#{$unit} !important;
View splitchunks.js
splitChunks{
cacheGroups: {
styles: {
name: 'styles',
test: /\.s?css$/,
chunks: 'all',
minChunks: 1,
reuseExistingChunk: true,
enforce: true,
},
View text.ts
import React, { useState, useEffect, useRef } from 'react';
import { LabelProps, LabelPosition } from '../../types';
import cs from 'classnames';
import { Text } from '@vx/text';
const styles = require('./LabelCompressed.scss');
export interface LabelPositioningProps {
angle: number;
View _spacing.scss
$screen-small-min: 480px;
$screen-medium-min: 768px;
$screen-large-min: 992px;
$screen-xlarge-min: 1200px;
$form-element-height: 42px;
/* be consistent with spacing to avoid random pixel adding. */
$scale: 8, 16, 32, 48;
View parentSize.ts
import React, { useState, useLayoutEffect, useCallback } from 'react';
import ResizeObserver from 'resize-observer-polyfill';
export interface ParentSizeState {
height: number;
width: number;
left: number;
top: number;
}
You can’t perform that action at this time.