Since macOS Sierra, when in Finder, you can use the shortcut:
CMD + SHIFT + .
| #!/bin/sh | |
| VAR=$(grep "MyVar" test | grep "^$MyVar" | cut -d'=' -f2-) | |
| echo $VAR |
| function log(...args) { | |
| console.log(...args); | |
| } |
| import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; | |
| import Loadable from 'react-loadable'; | |
| const Loading = () => <div>Loading...</div>; | |
| const Home = Loadable({ | |
| loader: () => import('./routes/Home'), | |
| loading: Loading, | |
| }); |
| // Each microservice should have an endpoint in a standard/agreed format for checking its health | |
| // This makes it extremely easy to check the health of all microservices | |
| // This can be run on a cronjob nightly | |
| { | |
| "healthy": true, | |
| "pods": 2, | |
| "podsAvailable": 2, | |
| "lastUpdated": "12:00:00 UTC", | |
| "errorMessage": "" |
| # Ensure create-react-app is Installed | |
| # For Github | |
| ``` | |
| $ create-react-app my-app --scripts-version git+ssh://[email protected]:<repo_owner>/<reponame>.git | |
| ``` | |
| # For Bitbucket (Git) |
| import { call, put, takeLatest } from 'redux-saga/effects'; | |
| /* | |
| const EXAMPLE_DISPATCHED_ACTION = { | |
| type: 'FETCH_REQUESTED', | |
| payload: { url: 'https://api.github.com' } | |
| } | |
| */ | |
| // Watcher |
| function scrollTo(element) { | |
| const bodyRect = document.body.getBoundingClientRect(); | |
| const elemRect = element.getBoundingClientRect(); | |
| const offset = Math.round(elemRect.top - bodyRect.top); | |
| window.scroll({ | |
| top: offset, | |
| left: 0, | |
| behavior: 'smooth' | |
| }); |
| function renameObjectKey(oldObj, oldName, newName) { | |
| const newObj = {}; | |
| Object.keys(oldObj).forEach(key => { | |
| const value = oldObj[key]; | |
| if (key === oldName) { | |
| newObj[newName] = value; | |
| } else { | |
| newObj[key] = value; |