Skip to content

Instantly share code, notes, and snippets.

import PQueue from 'p-queue';
export function Concurrency(limit: number): MethodDecorator {
if (!Number.isInteger(limit) || limit < 1) {
throw new Error(`@Concurrency requires a positive integer limit, got ${String(limit)}`);
}
return (_target, _propertyKey, descriptor: PropertyDescriptor): void => {
const queue = new PQueue({ concurrency: limit });
const original = descriptor.value;
descriptor.value = function (...args: unknown[]) {
const { getFolderCucumberSentences } = require('cucumber-steps-parser');
const sentences = getFolderCucumberSentences(
'path/to/your/project',
false,
/^.*\.step\.ts$/
);
import React from 'react';
import { link, ReduxComposedProps } from 'react-redux-link';
// ...
type ComponentProps = ReduxComposedProps<
{
// Properties injected from the parent component
fromParent: string;
},
{
import React from 'react';
import { connect } from 'react-redux';
// ...
interface ComponentProps {
fromParent: string;
fromState: string;
fromDispatch: () => void;
}
env_variables:
MYSQL_USER: <Your user>
MYSQL_PASSWORD: <Your password>
CLOUD_SQL_CONNECTION_NAME: <Your cloud sql instance>
DB_SOCKET_PATH: <The socket path> # Optional. Default value: "/cloudsql"
import { ConnectionOptions, createConnection, Connection } from 'typeorm';
import { config } from '../config';
const mysqlConnectionOptions: ConnectionOptions = {
type: 'mysql',
username: config.MYSQL_USER,
password: config.MYSQL_PASSWORD,
database: 'bromuro',
entities: [/*...*/],
synchronize: true,
import React from 'react';
export const WheelPoc: React.FC = () => {
const wheelStyle: React.CSSProperties = {
position: 'relative',
height: 300,
width: 300,
margin: '32px auto',
overflow: 'hidden',
borderRadius: 150,
import React from 'react';
export const WheelPoc: React.FC = () => {
const wheelStyle: React.CSSProperties = {
position: 'relative',
height: 300,
width: 300,
margin: '32px auto',
overflow: 'hidden',
borderRadius: 150,
{
// ...
"husky": {
"hooks": {
// ...
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
}
},
}
module.exports = {
extends: ['@commitlint/config-conventional']
};