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
<ul> | |
{ordinances.map((o) => <Ordinance ordinance={o} key={o.ReferenceNo} />)} | |
</ul> |
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
function getNameWithLetAndConst(options) { | |
// `name` scoped to its nearest parent block (here: the function-block) | |
let name = 'Jill' | |
if (options.test) { | |
// `combined` is scoped to its nearest parent block (here: the if-block) | |
// because of how block-scoping works, `name` is also available here | |
const combined = `${name}-tested` | |
if (options.someCondition) { |
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 ChainingAsync extends React.Component { | |
componentWillReceiveProps(newProps) { | |
// handle changes in connected props to do things | |
// like show alerts, redirect, etc. | |
} | |
updateThings(values) { | |
this.props.updateSequence(values) | |
// ^^ HERE, ASSUME updateThing1 FAILED... |
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
export class ProtectedRoute extends Component { | |
render() { | |
const { component: Component, auth, access, ...rest } = this.props; | |
return ( | |
<Route {...rest} render={(props) => ( | |
auth.loggedIn ? ( | |
access(state) ? <div><Component {...props} /></div> : <Something> | |
) : ( | |
<Redirect to={{ | |
pathname: '/auth', |
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
// actions/helpers/factory.js | |
export default function ({ request, onSuccess }) { | |
return (action) => (dispatch) => { | |
return request().then((results) => onSuccess({ results, dispatch })); | |
} | |
} |
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
# Service dependencies | |
REDIS_HOST=redis | |
REDIS_PORT=6379 | |
DB_HOST=db | |
DB_USER=postgres | |
DB_NAME=postgres | |
DB_PASS= | |
DB_PORT=5432 | |
# Federation |
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
<?php | |
class Wrapped { | |
public function __construct($type) { | |
$class = $type . 'Banner'; | |
$this->instance = new $class(); | |
} | |
} |
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 captureSuccess = (result) => ({ state: 'succeeded', result }) | |
const captureFail = (error) => ({ state: 'rejected', error }) | |
module.exports.allSettled = (promises, { only }) => { | |
const settled = Promise.all(promises.map((p) => p.then(captureSuccess).catch(captureFail))) | |
return only | |
? settled.then((results) => results.filter((r) => r.state === only).map((r) => r.result)) | |
: settled | |
} |
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
// anywhere we need to require the controller, either in production code or tests: | |
// const controller = require('../../../lib/controller') | |
const controller = require('lib/controller') | |
// etc. |
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
# from your local machine | |
# replace dokku.me with your domain name or the host's IP | |
# replace root with your server's root user | |
# USER is the username you use to refer to this particular key | |
cat ~/.ssh/id_rsa.pub | ssh [email protected] "sudo sshcommand acl-add dokku USER" |