Skip to content

Instantly share code, notes, and snippets.

View iamdanthedev's full-sized avatar
😃

Dan The Dev iamdanthedev

😃
  • Bonliva AB
  • Stockholm/Kiev
View GitHub Profile
export const withRouterProvider = story => (
<BrowserRouter>
<Route>{story()}</Route>
</BrowserRouter>
);
/usr/bin/node /home/danthedev/Projects/bonliva/CRM_work/Server/tests/api-test.js
{"name":"AzureAD: Bearer Strategy","hostname":"danthedev-station","pid":22091,"level":40,"msg":"Production environments should always validate the issuer.","time":"2018-03-16T11:04:50.538Z","v":0}
Connected to Mongo
warn: Parser warning in file '/home/danthedev/Projects/bonliva/CRM_work/Server/documentations/index.yml': Unable to generate application/json example message body out of JSON Schemaon line 584
warn: Parser warning in file '/home/danthedev/Projects/bonliva/CRM_work/Server/documentations/index.yml': Invalid content type 'application/json; charset=utf=8', invalid parameter formaton line 1013
info: Beginning Dredd testing...
info: Found Hookfiles: 0=/home/danthedev/Projects/bonliva/CRM_work/Server/tests/api-hooks.js
Running transaction:
consultant > /consultants > Get list of contacts > 200 > application/json; charset=utf-8
Number of documents inserted: 2
/usr/bin/node /home/danthedev/Projects/bonliva/CRM_work/Server/tests/api-test.js
{"name":"AzureAD: Bearer Strategy","hostname":"danthedev-station","pid":21389,"level":40,"msg":"Production environments should always validate the issuer.","time":"2018-03-16T10:54:20.372Z","v":0}
Connected to Mongo
warn: Parser warning in file '/home/danthedev/Projects/bonliva/CRM_work/Server/documentations/index.yml': Unable to generate application/json; charset=utf-8 example message body out of JSON Schemaon line 167
warn: Parser warning in file '/home/danthedev/Projects/bonliva/CRM_work/Server/documentations/index.yml': Unable to generate application/json example message body out of JSON Schemaon line 196
warn: Parser warning in file '/home/danthedev/Projects/bonliva/CRM_work/Server/documentations/index.yml': Unable to generate application/json example message body out of JSON Schemaon line 196
warn: Parser warning in file '/home/danthedev/Projects/bonliva/CRM_work/Server/documentations/index.yml': Unable to generate applicat
@iamdanthedev
iamdanthedev / SomeContainer.tsx
Last active March 16, 2018 06:47
withRouteBlock HOC to prevent transitions
export default compose<Props, OwnProps>(
withHistory,
withRouteBlock("Already leaving?")
)(SomeContainer);
@iamdanthedev
iamdanthedev / SelectField.js
Created March 15, 2018 08:22
react-select on material-ui in a formik field
import React from "react";
import P from "prop-types";
import ReactSelect, {
Creatable as ReactSelectCreatable,
Async as ReactSelectAsync,
AsyncCreatable as ReactSelectAsyncCreatable
} from "react-select";
import get from "lodash/get";
import { Field } from "formik";
import { withStyles } from "material-ui";
@iamdanthedev
iamdanthedev / InlineSelect.tsx
Created March 14, 2018 09:26
Styling material-ui components with not hussle
import React from "react";
import { withStyles } from "material-ui";
import Select, { SelectProps } from "material-ui/Select";
import { MenuItem } from "material-ui/Menu";
type OwnProps = SelectProps & {
options: Array<{ label: string; value: string }>;
}
type Props = OwnProps & {
@iamdanthedev
iamdanthedev / stories-index.js
Created February 19, 2018 13:04
storybook formik decorator
const initialValues = { comment: 'hello'; }
storiesOf('Form Controls: Select', module)
.addDecorator(withFormValues(initialValues)
.add('default', () => (
<Select name="select" label="Country..." options={selectOptions} />
</Formik>
))
@iamdanthedev
iamdanthedev / actions.ts
Created February 7, 2018 11:28
typescript-fsa redux approach
/**
* Recipe Editor Local Actions
*/
import actionCreatorFactory from 'typescript-fsa';
const actionCreator = actionCreatorFactory('@@local/RecipeEditor');
export const showAddGroupDialog = actionCreator('SHOW_ADD_GROUP_DIALOG');
@iamdanthedev
iamdanthedev / 1) item-list-store
Last active January 30, 2018 09:47
redux work example
import { isType } from 'typescript-fsa';
import { Reducer } from 'redux';
import * as actions from './actions';
/**
* Item-List local store
*/
export interface LocalState {
@iamdanthedev
iamdanthedev / 3cols.tsx
Created January 26, 2018 00:04
Three column + header layout react component
import * as React from 'react';
import styled from 'styled-components';
import { Col, Grid, Row } from 'react-styled-flexboxgrid';
import Form from 'semantic-ui-react/dist/commonjs/collections/Form/Form';
import { SubheaderCentered } from '../typography/Subheader';
/**
* |-------------------|
* | |