Skip to content

Instantly share code, notes, and snippets.

View mauriciogofas's full-sized avatar

Mauricio Gofas mauriciogofas

View GitHub Profile
@mauriciogofas
mauriciogofas / magento-nginx.conf
Created October 15, 2016 05:03 — forked from gwillem/magento-nginx.conf
Battle-tested Nginx configuration for Magento (source: www.hypernode.com)
# This is an annotated subset of the Nginx configuration from our Magento production platform @ www.hypernode.com
# See https://www.byte.nl/blog/magento-cacheleak-issue
# !!!! If you are a Hypernode customer, do not use this config as it will result in duplicate statements. !!!!!
user app;
worker_processes 4;
pid /var/run/nginx.pid;
events {
@mauriciogofas
mauriciogofas / cancelatransacao.php
Last active June 29, 2016 20:55
Cancela transação Gerencianet APi
<?php
require __DIR__ . '/sdk/vendor/autoload.php';
use Gerencianet\Exception\GerencianetException;
use Gerencianet\Gerencianet;
$clientId = 'your_client_id'; // Client ID da aplicação
$clientSecret = 'your_client_secret'; // Client Secret da aplicação
$options = [
'client_id' => $clientId,
@mauriciogofas
mauriciogofas / istall.ssh
Created June 8, 2016 04:48
Instalar Módulo Gofas WHMCS Gerencianet Boleto via SSH
cd /var/www/htdocs/WHMCS/modules/gateways/ && wget https://github.com/gofas/whmcs-gerencianet-boleto/archive/master.zip && unzip master.zip && cd whmcs-gerencianet-boleto-master/ && mv gofasgerencianetboleto.php ../ && mv gofasgerencianetboleto/ ../ && cd ../ && rm -rf whmcs-gerencianet-boleto-master/ && rm master.zip
@mauriciogofas
mauriciogofas / woo-nginx.conf
Last active February 12, 2016 16:01 — forked from rahul286/moved.md
woo-commerce fastcgi-cache session-conflict solution (attempt)
# WPSINGLE BASIC NGINX CONFIGURATION
server {
server_name woo.rtcamp.net www.woo.rtcamp.net;
access_log /var/log/nginx/woo.rtcamp.net.access.log rt_cache;
error_log /var/log/nginx/woo.rtcamp.net.error.log debug;
root /var/www/woo.rtcamp.net/htdocs;
index index.php index.htm index.html;
@mauriciogofas
mauriciogofas / target _blank_admin_bar_view_site.php
Last active December 21, 2015 18:57
Target blank on Admin Bar Home Link
/*
target _blank on Admin Bar Home Link
*/
add_action( 'admin_bar_menu', 'gofas_site_name', 80 );
function gofas_site_name( $wp_admin_bar ) {
//Get a reference to the site-name node to modify.
$node = $wp_admin_bar->get_node('site-name');
//Change target
$node->meta['target'] = '_blank';
//Update Node.
@mauriciogofas
mauriciogofas / remove-wp-logo-admin-toolbar.php
Created December 4, 2015 17:14
remove wp logo Admin Toolbar
// remove wp logo Admin Toolbar
add_action( 'admin_bar_menu', 'remove_wp_logo', 999 );
function remove_wp_logo( $wp_admin_bar ) {
$wp_admin_bar->remove_node( 'wp-logo' );
}
@mauriciogofas
mauriciogofas / config.json
Last active November 25, 2015 12:32 — forked from anonymous/config.json
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
@mauriciogofas
mauriciogofas / estados-do-brasil
Last active November 18, 2015 01:14
Lista de estados do Brasil para formulários e afins
Acre (AC)
Alagoas (AL)
Amapá (AP)
Amazonas (AM)
Bahia (BA)
Ceará (CE)
Distrito Federal (DF)
Espírito Santo (ES)
Goiás (GO)
Maranhão (MA)
@mauriciogofas
mauriciogofas / translate-text-domains.php
Last active November 18, 2015 01:14
Translate text_domains
add_filter( 'gettext', 'theme_change_comment_field_names', 20, 3 );
/**
* Change comment form default field names.
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function theme_change_comment_field_names( $translated_text, $text, $domain ) {
if ( is_singular() ) {
@mauriciogofas
mauriciogofas / delete-files.php
Last active November 18, 2015 01:14
#php - Delete directory with files in it (recursive)
<?php
/* Font: http://stackoverflow.com/questions/3349753/delete-directory-with-files-in-it */
$dir = '/home/username/public_html/beta/' . DIRECTORY_SEPARATOR . 'sub-folder';
$it = new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS);
$files = new RecursiveIteratorIterator($it,
RecursiveIteratorIterator::CHILD_FIRST);
foreach($files as $file) {
if ($file->isDir()){
rmdir($file->getRealPath());
} else {