If .DS_Store was never added to your git repository, simply add it to your .gitignore file.
.gitignore
In your the root directory of your app and simply write
function useSelectors(reducer, mapStateToSelectors) { | |
const [state] = reducer; | |
const selectors = useMemo(() => mapStateToSelectors(state), [state]); | |
return selectors; | |
} | |
function useActions(reducer, mapDispatchToActions) { | |
const [, dispatch] = reducer; | |
const actions = useMemo(() => mapDispatchToActions(dispatch), [dispatch]); | |
return actions; |
/* variation on https://medium.com/@DanHomola/react-higher-order-components-in-typescript-made-simple-6f9b55691af1 */ | |
import * as React from 'react' | |
import { wrapDisplayName } from 'recompose' | |
// Props you want the resulting component to take (besides the props of the wrapped component) | |
interface ExternalProps {} | |
// Props the HOC adds to the wrapped component | |
export interface InjectedProps {} |
import * as React from 'react'; | |
interface IProps { | |
propName?: any; | |
loadingTime?: boolean; | |
} | |
const loadingHOC = ({ propName, loadingTime = false }: IProps) => < | |
P extends {} | |
>( | |
WrappedComponent: React.ComponentClass<P> | React.StatelessComponent<P> |
const Agenda = require('agenda'); | |
const mongoConnectionString = 'mongodb://localhost:27017/yourdatabase'; | |
// or override the default collection name: | |
let agenda = new Agenda({db: {address: mongoConnectionString, collection: 'jobs'}}); | |
let jobTypes = process.env.JOB_TYPES ? process.env.JOB_TYPES.split(',') : []; | |
jobTypes.forEach(function(type) { |
const BACKEND_URL = 'https://fakeserver.com/api' | |
export function signUpUser(email, password) { | |
return async (dispatch) => { | |
try { | |
const signUp = await axios.post(`${BACKEND_URL}/signup`, { | |
email: email, | |
password: password | |
}) | |
import React from 'react'; | |
import { storiesOf } from '@storybook/react'; | |
// 1. import axios and MockAdapter | |
import axios from 'axios'; | |
import MockAdapter from 'axios-mock-adapter'; | |
// 2. create the mock | |
const mock = new MockAdapter(axios); |
/** | |
* Example to refresh tokens using https://github.com/auth0/node-jsonwebtoken | |
* It was requested to be introduced at as part of the jsonwebtoken library, | |
* since we feel it does not add too much value but it will add code to mantain | |
* we won't include it. | |
* | |
* I create this gist just to help those who want to auto-refresh JWTs. | |
*/ | |
const jwt = require('jsonwebtoken'); |
> SSH Login to your home directory. | |
> Get APT updates & upgrades. | |
sudo apt-get update | |
sudo apt-get upgrade | |
> NodeJS & NPM | |
> https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions | |
> Installs the latest NodeJS & NPM, including the essential build tools (used by most packages). |