- Python 3
- Pip 3
$ brew install python3
### Apache Rewrite | |
# Request resides in your 'sites/default/files' folder. | |
RewriteCond %{REQUEST_URI} ^/sites/default/files/(.*)$ | |
# File doesn't exist. | |
RewriteCond %{REQUEST_FILENAME} !-f | |
# Directory doesn't exist. | |
RewriteCond %{REQUEST_FILENAME} !-d | |
# Redirect request to your development or production server. | |
RewriteRule ^/sites/default/files/(.*)$ http://dev.example.com/sites/default/files/$1 [L] |
# | |
# CORS header support | |
# | |
# One way to use this is by placing it into a file called "cors_support" | |
# under your Nginx configuration directory and placing the following | |
# statement inside your **location** block(s): | |
# | |
# include cors_support; | |
# | |
# As of Nginx 1.7.5, add_header supports an "always" parameter which |
<?php | |
/** | |
* @file | |
* Definition of the 'bootstrap_style' panels style plugin. | |
*/ | |
$plugin = array( | |
'title' => t('Example Parent Style'), | |
'description' => t('Example style providing substyles'), |
/* | |
# Print Map | |
Usage: | |
// option 1 | |
.debug { | |
@include print-map($map); | |
} |
php -i | grep 'Configure Command =>' | awk '{for(i=5; i<=NF; i++) {print substr($i, 2, (length($i) - 2))}}' |
<?php | |
class FacebookDebugger | |
{ | |
/* | |
* https://developers.facebook.com/docs/opengraph/using-objects | |
* | |
* Updating Objects | |
* | |
* When an action is published, or a Like button pointing to the object clicked, | |
* Facebook will 'scrape' the HTML page of the object and read the meta tags. |
SELECT | |
TABLE_SCHEMA, | |
TABLE_NAME, | |
DATA_LENGTH / POWER(1024,1) Data_KB, | |
DATA_LENGTH / POWER(1024,2) Data_MB, | |
DATA_LENGTH / POWER(1024,3) Data_GB | |
FROM information_schema.tables WHERE table_schema NOT IN ('information_schema','performance_schema','mysql') ORDER BY DATA_LENGTH; |
# Redis Cheatsheet | |
# All the commands you need to know | |
redis-server /path/redis.conf # start redis with the related configuration file | |
redis-cli # opens a redis prompt | |
# Strings. |
<?php | |
namespace Drupal\my_module\Services; | |
use Drupal\Core\Config\ConfigFactory; | |
/** | |
* Class MyService. | |
* | |
* @package Drupal\my_module\Services |