Search By Label
types
are indexed by the default whereas interfaces
are not. It makes interfaces
more safe. type Admin = { name: string, privileges: string[] } type Employee = { name: string, startDate: Date } type CombinedType = Admin & Employee; interface CombinedInterface extends Admin, Employee { } const interfaceData: CombinedInterface = { name: '', privileges: [], startDate: new Date() } const typeData: CombinedType = { name: '', privileges: [], startDate: new Date() } const handleType = (obj: Record<string, unknown>) => { obj['name'] = 42 // unsafe } handleType(interfaceData) // error handleType(typeData) // ok
process.nextTick
is a Node.js feature that defers the execution of a callback function to the next iteration of the event loop. It's often used when immediate execution is necessary, but the function should be deferred to avoid blocking the event loop. For example, in scenarios where you want to ensure that certain asynchronous operations are complete before continuing, process.nextTick
can be employed.git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch <path to the file or directory>' --prune-empty --tag-name-filter cat -- --all
pip3 install git-filter-repo
git filter-repo --path <path to the file or directory> --invert-paths
git filter-branch --env-filter ' OLD_EMAIL="old-test@test.com" CORRECT_NAME="Oswaldo Pineda" CORRECT_EMAIL="new-test@test.com" if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] then export GIT_COMMITTER_NAME="$CORRECT_NAME" export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" fi if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] then export GIT_AUTHOR_NAME="$CORRECT_NAME" export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" fi ' --tag-name-filter cat -- --branches --tags
memo
lets you skip re-rendering a component when its props are unchanged.memo
to get a memoized version of that component. This memoized version of your component will usually not be re-rendered when its parent component is re-rendered as long as its props have not changed. But React may still re-render it: memoization is a performance optimization, not a guarantee.import { memo } from 'react';
const SomeComponent = memo(function SomeComponent(props) {
// ...
});
heroku pg:backups:capture -a your-production-name-app
heroku pg:backups:restore <production-database-name>::<you-backups-id> DATABASE_URL --app <production-staging-enviroment> --confirm <production-staging-enviroment>
heroku pg:backups:restore juanequex-prod::b194 DATABASE_URL --app juanequex-staging --confirm juanequex-staging
heroku pg:backups:capture -a your-production-name-app
pg_restore --verbose --clean --no-acl --no-owner -h localhost -d <data-base-name> /Users/juanequex/backups/<your-local-backup>
npm show
command is used to display detailed information about a package available on the npm registry. npm show
command:npm show <package-name>
npm show
retrieves information directly from the npm registry, so it doesn't require the package to be installed locally. It's a convenient way to inspect package details before deciding to install or use a particular version.npm outdated
package.json
and see if there is a newer version in the NPM registry.jQuery
is installedimport $ from 'jQuery'
...
var content = $('#id').html();
import
statement so you have to transpile the code with Webpack commands, the bundler will check all the used dependencies and bind them in a single file without any dependency problems.git stash list
git stash show
git stash show -p
git stash show -p stash@{1}
git stash show -p 1