Skip to content

Instantly share code, notes, and snippets.

View mateuslopes's full-sized avatar

Mateus Lopes mateuslopes

View GitHub Profile
@mateuslopes
mateuslopes / mysql_backup.sh
Created June 3, 2012 18:26 — forked from stabenfeldt/mysql_backup.sh
MySQL: Backup a database in one command line
mysqldump -u USER -p PASSWORD database | gzip -9 > BACKUP/prod-`date +%Y.%m.%d`c.gz
@mateuslopes
mateuslopes / wp-change-site-url.sql
Last active February 19, 2020 13:43
SQL+Wordpress: Changing WP Site Url
SET NAMES 'utf8mb4';
SET CHARACTER SET 'utf8mb4';
SET @origin_url = 'http://localhost/origem';
SET @destiny_url = 'http://localhost/destino';
UPDATE wp_options
SET option_value = REPLACE(option_value, @origin_url, @destiny_url)
WHERE option_value LIKE (CONCAT('%',@origin_url,'%'));
@mateuslopes
mateuslopes / EmptyWidget.php
Created June 3, 2012 16:38 — forked from jonathonbyrdziak/CustomWidgetFile.php
Plugin code to create a single widget in wordpress.
<?php
/**
* @package RedRokk
* @version 1.0.0
*
* Plugin Name: Empty Widget
* Description: Single Widget Class handles all of the widget responsibility, all that you need to do is create the html. Just use Find/Replace on the Empty_Widget keyword to rebrand this class for your needs.
* Author: RedRokk Interactive Media
* Version: 1.0.0
* Author URI: http://www.redrokk.com
@mateuslopes
mateuslopes / gist:2864082
Created June 3, 2012 16:25 — forked from jlengstorf/gist:2864077
.htaccess: Increase max upload file size
php_value upload_max_filesize 20M
php_value post_max_size 20M
@mateuslopes
mateuslopes / wp-dbquery-output.php
Created June 3, 2012 16:23 — forked from bradp/gist:2863967
WordPress: DB Query Output Monitor
<?php
function performance( $visible = false ) {
$stat = sprintf( '%d queries in %.3f seconds, using %.2fMB memory',
get_num_queries(),
timer_stop( 0, 3 ),
memory_get_peak_usage() / 1024 / 1024
);
@mateuslopes
mateuslopes / css-vertical-align-center.css
Created June 3, 2012 16:11
CSS: Vertical align center (without line-height)
.v-center, .vertical-center, .v-middle, .vertical-middle {
display: table-cell;
vertical-align: middle;
}