This file contains hidden or 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 StyledWrapper = styled.div` | |
| .foo-component{ | |
| background-color: red; | |
| .foo-component__item{ | |
| background-color: blue; | |
| } | |
| } | |
| ` | |
| <StyleWrapper> | |
| <ul className="foo-component"> |
This file contains hidden or 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' | |
| const Rect = (props) => <rect {...props}></rect> | |
| export const MyFirstAwesomeChart = ({x, y}) => | |
| <svg> | |
| <Rect x={x} y={y} width={100} height={50} /> | |
| </svg> |
This file contains hidden or 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
| var field = svg.selectAll("g") | |
| .data(fields) | |
| .enter() | |
| .append("g"); |
This file contains hidden or 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
| rpcServer.invoke('fastFilter', 'my-filter-id', { "range": [10,20] }, (err, done) => { | |
| // handle response or error | |
| }); |
This file contains hidden or 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 lodashId = require('lodash-id') | |
| const FileSync = require('lowdb/adapters/FileSync') | |
| | |
| const adapter = new FileSync('db.json') | |
| const db = low(adapter) | |
| | |
| db._.mixin(lodashId) | |
| | |
| // We need to set some default values, if the collection does not exist yet | |
| // We also can store our collection |
This file contains hidden or 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
| <ArrayElement keyPath="subsets" onChange={updateReduxState}> | |
| <ObjectElement wrapper> | |
| <StringInput keyPath="name"/> | |
| <QueryInput keyPath="column" options={availableColumns}/> | |
| <StringInput keyPath="value" /> | |
| <ColorInput keyPath="color" /> | |
| </ObjectElement> | |
| <ArrayElement/> |
This file contains hidden or 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
| <ObjectElement keyPath="user" onChange={doChange}> | |
| <div> | |
| <StringInput keyPath="name"/> | |
| </div> | |
| </ObjectElement> |
This file contains hidden or 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
| // my-service.hooks.js | |
| module.exports = { | |
| before:{ | |
| find:[ | |
| async findQuery(context){ | |
| // get the client (Express global) | |
| const { db } = context.app.get('knexClient') | |
| // build and run the query | |
| const q = db.raw(`SELECT * FROM TABLE`) | |
| const res = await q |
This file contains hidden or 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
| class MyService { | |
| constructor(options) { | |
| // options must contain the knexClient | |
| // (simply pass it when initializing the service) | |
| this.options = options || {}; | |
| } | |
| async find(params){ | |
| const { db } = this.options | |
| const q = db.raw(`SELECT * FROM TABLE`) |
This file contains hidden or 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
| VendingMachines.addField([ | |
| { | |
| fieldName: 'lastRefillAt', | |
| fieldSchema: { | |
| type: Date, | |
| optional: true, | |
| viewableBy:['runners', 'managers', 'admins'], | |
| resolveAs: { | |
| type: 'Date', | |
| resolver(vendingMachine, args, context) { |
OlderNewer