Skip to content

Instantly share code, notes, and snippets.

Avatar

4RCH!73C7 collinglass

  • Ottawa, Canada
View GitHub Profile
View giftedMessageContainer.js
export default class MessageContainer extends React.Component {
// ...
renderFooter() {
if (this.props.renderFooter) {
const footerProps = {
...this.props,
};
return this.props.renderFooter(footerProps);
}
return null;
View completelyDifferent.js
renderLoadEarlier(loadEarlierProps) {
return <MyLoadEarlier
text={loadEarlierProps.content}
/>
}
render() {
return <MessageContainer {...props} renderHeader={this.renderHeader}>
}
View removeLoadEarlier.js
// ...
render() {
return <MessageContainer
{...props}
renderLoadEarlier={() => null}
/>
}
View renderX.js
export default class Card extends Component {
constructor(props) {
super(props);
}
renderHeader(headerProps) {
if (!this.props.renderHeader) {
return this.props.renderHeader(headerProps)
}
View example.json
{
"data": {
"result": null,
"type": "object",
"parent": "/api/users",
"options": {}
},
"error": {
"type": "not found",
"message": "no users found",
View troll.go
_, err := TrollIEUsers()
if err != nil {
handleError(w, err)
return
}
View apiResponse.go
type APIResponse struct {
Data interface{} `json:”data”`
Error string `json:”error”`
Status int `json:”status”`
}
@collinglass
collinglass / deepcopy.js
Last active Aug 29, 2015
javascript snippets
View deepcopy.js
// function to deep copy an object
function deepCopy(object) {
return JSON.parse(JSON.stringify(object));
}
@collinglass
collinglass / .pagevue.js
Last active Sep 1, 2019
Simple Multi-View Routing with Page.js and Vue.js
View .pagevue.js
Simple Multi-View Routing with Page.js and Vue.js
You can’t perform that action at this time.