Skip to content

Instantly share code, notes, and snippets.

@suissa
suissa / findById.js
Created March 4, 2017 04:41
FInd by ID no Mongoose funcional
const getQuery = ( req ) => ( { _id: req.params.id } )
const getFields = ( req ) =>
( req.query.fields )
? req.query.fields.replace( ',', ' ' )
: ''
const getCbSuccess = ( res ) => require( './ribossomos/success-200-json' )( res )
const getCbError = ( res ) => require( './ribossomos/error-json' )( res )
module.exports = ( Organism ) =>
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory