View gist:5602186
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StringBuilder sb = new StringBuilder(); | |
if (ConfigurationManager.AppSettings.HasKeys()) | |
{ | |
sb = new StringBuilder( "<ul style=\"list-style-type:none;\">" ); | |
foreach (string key in ConfigurationManager.AppSettings.Keys) | |
{ | |
sb.AppendFormat( "<li><strong>{0}</strong> - {1}</li>", key, ConfigurationManager.AppSettings[key] ); | |
} |
View GoodPropTypes.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import propTypes from ‘prop-types’; | |
const propTypes = { | |
findDelay: PropTypes.number, | |
columns: PropTypes.array, | |
loadCollapsed: PropTypes.bool, | |
tableHeight: PropTypes.number, | |
rowHeight: PropTypes.number, | |
defaultColWidth: PropTypes.number, | |
}; |
View BadPropTypes.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.findDelay = typeof this.props.findDelay === 'number' ? this.props.findDelay : 500; | |
this.options = props.gridOptions; | |
this.options.columns = this.options.columns ? this.options.columns : []; | |
this.options.loadCollapsed = this.options.loadCollapsed ? this.options.loadCollapsed : false; | |
this.options.tableHeight = this.options.tableHeight ? this.options.tableHeight : 500;this.options.rowHeight = this.options.rowHeight ? this.options.rowHeight : 96; | |
this.defualtColWidth = this.options.columns.length ? `${100 / this.options.columns.length}%` : null; |
View StatelessFunctionalComponent.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const HelloWorld = ({name}) => ( | |
<div>{`Hi ${name}`}</div> | |
); |
View BadStyles.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Modal | |
isOpen={this.props.isOpen} | |
className="wrapper no-select" | |
contentLabel="No Content Modal" | |
style={{overlay: {"backgroundColor": "transparent"}}}> |
View GoodStyles.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# JSX | |
render() { | |
let hiddenClass = ''; | |
if (this.props.hideArrow) { | |
hiddenClass = 'hide'; | |
} | |
return ( | |
<button className={`filter-toggle ${hiddenClass}`} |
View SampleUnitTests.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { shallow } from 'enzyme'; | |
import toJSON from 'enzyme-to-json'; | |
import StarRating from '../components/StarRating'; | |
describe('StarRating sharedComponent', () => { | |
it('should match a snapshot', () => { | |
const wrapper = shallow(<StarRating />); | |
expect(toJSON(wrapper)).toMatchSnapshot(); |
View IndexAsKeyBad.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
items.map((item, index) => { | |
return (<ItemComponent key={index} item={item} />); | |
}); |
View IndexAsKeyGood.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const shortid = require('shortid'); | |
items.map((item) => { | |
return (<ItemComponent key={shortid.generate()} item={item} />); | |
}); |
View SinonExample.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('BidListButtonComponent', () => { | |
const bidList = [{ position: { id: 1 } }]; | |
const bidListFalse = [{ position: { id: 2 } }]; | |
it('can call the toggleSaved function', () => { | |
const spy = sinon.spy(); | |
const wrapper = shallow( | |
<BidListButton | |
id={1} | |
toggleBidPosition={spy} |
OlderNewer