Skip to content

Instantly share code, notes, and snippets.

import _ from 'lodash'
const logger = false
const consoleLog = (...args) => {
if (logger) {
console.log(...args)
}
}
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
export const schemaThirdStepPoll = Yup.object().shape<Partial<PollOrOssParams>>({
questions: Yup.array()
.ensure()
.of(
// @ts-ignore
Yup.lazy<any>((item, options) => {
const itemIndex = options.parent.indexOf ? options.parent.indexOf(item) : -1;
let description = Yup.string().min(50);
if (itemIndex > 0) {
import ReactSelect, { Props } from 'react-select'
import { customStyles, getTheme } from './styles'
import { ReactNode, useMemo } from 'react'
import { FormControl } from '../FormControl'
export const SelectRaw = (props: Props) => {
const theme = useMemo(() => getTheme(props.error), [props.error])
return (
<ReactSelect
classNamePrefix="react-select"
import { useEffect, useRef } from 'react'
import { isEqual } from 'lodash'
import { notice } from 'uikit'
import { handleFetchError } from 'utils/exceptions'
import { useSafeSetState } from './useSetState'
function usePrevious(value) {
const ref = useRef()
useEffect(() => {
@Cloudo
Cloudo / git-timesheet.sh
Created November 1, 2018 08:07
bash script to log git commits grouped by day
#!/bin/bash
# Generates git changelog grouped by day
#
# optional parameters
# -a, --author to filter by author
# -s, --since to select start date
# -u, --until to select end date
git-timesheet () {
@Cloudo
Cloudo / utils.js
Created October 12, 2018 07:30
cypress utils
export const getElementById = q => Cypress.$(`#${q}`)[0]
export const getElementByName = q => Cypress.$(`[name="${q}"]`)[0]
export const getElement = q => getElementById(q) || getElementByName(q)
export const get = q => cy.get(`#${CSS.escape(q)}`)
export const uncheck = q => {
const checkbox = getElement(q)
if (checkbox && checkbox.checked) {
import React from 'react'
import { BooleanValue } from 'react-values'
import { css } from 'emotion'
import { Button, ConfirmDialog } from 'uikit'
import validate from './validate'
const SaveButtonWithDialog = ({ disabled, onConfirm, handleSubmit }) => (
<BooleanValue>
@Cloudo
Cloudo / fetch.jsx
Created March 6, 2018 15:20
fetch jsx
/* @flow */
import { handleActions, createAction } from 'redux-actions'
import { createNamedWrapperReducer } from 'utils/reducers'
const prefix = 'fetch'
/**
* FLOWTYPES
*/
export type Actions<Payload> = {
hello