Skip to content

Instantly share code, notes, and snippets.

View guiajlopes's full-sized avatar

Guilherme Lopes guiajlopes

  • Novo Hamburgo, Brazil
View GitHub Profile
@guiajlopes
guiajlopes / buffer_channel.go
Last active October 28, 2018 13:31
Go buffered channel
import (
"sync"
"fmt"
)
func maxGoRoutinesExample(maxNumberOfConnections int) {
var wg sync.WaitGroup
guard := make(chan int, maxNumberOfConnections)
for i := 0; i < 100; i++ {
<?php
/**
* Reloads translation file for a given module.
*
* @param mixed $module
* Module(s) name(s). An array of strings or a string.
* @param mixed $languages
* @return array
* An array with a "success" key which is a boolean and a "query" key which
@guiajlopes
guiajlopes / wp_supercache.conf
Created December 1, 2015 12:16
supercache configration
# -*- mode: nginx; mode:autopair; mode: flyspell-prog; ispell-local-dictionary: "american" -*-
### WP configuration for using the supercache plugin.
## Mimicking the .htaccess mod_rewrite rules in Nginx. They all return
## 405 which means unsupported method.
## The line below is no longer needed for supercache
## 0.9.9.9. Uncomment the 3 lines below if using and older version.
# if ($request_uri ~ ^.*//.*$) {
@guiajlopes
guiajlopes / wordpress.conf
Created November 30, 2015 17:51
Configuração do wordpress pra nginx
## Cache control. Useful for WP super cache.
add_header Cache-Control "store, must-revalidate, post-check=0, pre-check=0";
## If no favicon exists return a 204 (no content error).
location = /favicon.ico {
try_files $uri =204;
log_not_found off;
access_log off;
}
<?php
// Load a drushrc.php file from the 'drush' folder at the root of the current
// git repository.
if ($repo_root = _drushrc_find_repo_root()) {
drush_set_context('DRUSH_REPO_ROOT', $repo_root);
if (is_dir($repo_root . '/drush')) {
if (is_file($repo_root . '/drush/drushrc.php')) {
$options['config'] = $repo_root . '/drush/drushrc.php';
}