<meta property="og:title" content="title" />
<meta property="og:description" content="desc" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://url.com/" />
<meta property="og:image" content="http://url.com/image.jpg" />
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
| # Assumes the database container is named 'db' | |
| DOCKER_DB_NAME="$(docker-compose ps -q db)" | |
| DB_HOSTNAME=db | |
| DB_USER=postgres | |
| LOCAL_DUMP_PATH="path/to/local.dump" | |
| docker-compose up -d db | |
| docker exec -i "${DOCKER_DB_NAME}" pg_restore -C --clean --no-acl --no-owner -U "${DB_USER}" -d "${DB_HOSTNAME}" < "${LOCAL_DUMP_PATH}" | |
| docker-compose stop db |
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
| CREATE USER aditya with password 'aditya'; | |
| ALTER USER aditya with SUPERUSER CREATEDB CREATEROLE REPLICATION BYPASSRLS; |
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
| # Get ubuntu version | |
| >> sudo lsb_release -a | |
| # For xenial (16.04.2 LTS) | |
| >> sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt xenial-pgdg main" >> /etc/apt/sources.list' | |
| >> wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add - | |
| >> sudo apt-get update |
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
| // Generate unique IDs for use as pseudo-private/protected names. | |
| // Similar in concept to | |
| // <http://wiki.ecmascript.org/doku.php?id=strawman:names>. | |
| // | |
| // The goals of this function are twofold: | |
| // | |
| // * Provide a way to generate a string guaranteed to be unique when compared | |
| // to other strings generated by this function. | |
| // * Make the string complex enough that it is highly unlikely to be | |
| // accidentally duplicated by hand (this is key if you're using `ID` |
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
| async function handler(req, res, next) { | |
| const userSchema = Joi.object().keys({ | |
| name: Joi.string().required(), | |
| age: Joi.number().integer() | |
| }); | |
| const params = req.params; | |
| const {error, validValues} = Joi.validate(params, userSchema); | |
| let result = null; |
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 { blueprint, types, validator } = require('podeng'); | |
| async function handler(req, res, next) { | |
| const UserShema = blueprint.object({ | |
| name: types.string({ serialize: { to: 'username' }}), | |
| age: types.integer | |
| }); | |
| const params = req.params; | |
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
| { | |
| "af": "Afrikaans", | |
| "sq": "Albanian", | |
| "am": "Amharic", | |
| "ar_DZ": "Arabic - Algeria", | |
| "ar_BH": "Arabic - Bahrain", | |
| "ar_EG": "Arabic - Egypt", | |
| "ar_IQ": "Arabic - Iraq", | |
| "ar_JO": "Arabic - Jordan", | |
| "ar_KW": "Arabic - Kuwait", |