This file contains 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
SELECT | |
relname AS "relation", | |
pg_size_pretty(pg_relation_size(C.oid)) AS "size", | |
pg_size_pretty(pg_total_relation_size(C.oid)) AS "size_with_indexes" | |
FROM | |
pg_class C | |
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) | |
WHERE | |
nspname NOT IN ('pg_catalog', 'information_schema') | |
AND C.relkind <> 'i' |
This file contains 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
autocannon --connections 10 --duration 10 --headers content-type=application/json --method POST --body 'SOME JSON HERE' SOME_TARGET_URL |
This file contains 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
open -na "Google Chrome" --args --user-data-dir=$SOME_FOLDER |
This file contains 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 { Octokit } from "@octokit/rest"; | |
// Go to github settings and create a token. Add permissions for user/email | |
const auth_token = 'YOUR TOKEN'; | |
const octokit = new Octokit({ | |
auth: auth_token, | |
}); | |
const response = await octokit.graphql(` |
This file contains 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
$ npx create-react-app $PROJECT_NAME | |
$ cd $PROJECT_NAME | |
$ npm i -g @storybook/cli | |
$ getstorybook | |
$ yarn run storybook |
This file contains 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 domain = location.protocol + '//' + location.hostname + (location.port ? ':' + location.port : ''); |
This file contains 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: https://codeburst.io/accessing-nested-objects-in-javascript-c2ed249fe576 | |
const getNestedObject = (nestedObj, pathArr) => { | |
return pathArr.reduce((obj, key) => | |
(obj && obj[key] !== 'undefined') ? obj[key] : null, nestedObj); | |
} |
This file contains 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
/* | |
* Migration | |
*/ | |
module.exports = { | |
up: function (queryInterface, Sequelize) { | |
return queryInterface.createTable('JobSkills', { | |
experience: { | |
type: Sequelize.INTEGER, | |
allowNull: false | |
}, |
This file contains 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 asyncHandler = fn => | |
(req, res, next) => { | |
Promise.resolve(fn(req, res, next)) | |
.catch(next); | |
}; | |
// Usage | |
express.get('/', asyncHandler(async (req, res, next) => { | |
const bar = await foo.findAll(); | |
res.send(bar) |
This file contains 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, { Component } from 'react'; | |
import { Provider } from 'react-redux'; | |
import initialState from './store/initialState'; | |
import createStore from './store/createStore'; | |
const store = createStore(initialState); | |
const getDisplayName = WrappedComponent => WrappedComponent.displayName || WrappedComponent.name || 'WrappedComponent'; | |
/** | |
* HOC to wrap a component within redux provider to allow access the store. |
NewerOlder