This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* ClientScript class file. | |
* | |
* @author Tsunu {@link http://www.yiiframework.com/forum/index.php/topic/24429-the-best-way-to-write-javascript/page__p__118436#entry118436} | |
* @author MGHollander {@link https://github.com/MGHollander} | |
*/ | |
/** | |
* ClientScript class is an extension on Yii's CClientScript to register scripts inside a view. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Topic: https://wordpress.org/support/topic/problem-on-adding-local-and-shortcode?replies=4#post-7851880 | |
*/ | |
//Show Map by Address | |
function show_map(id, div, lat, lng) { | |
var geocoder; | |
var map; | |
geocoder = new google.maps.Geocoder(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_drush_sql_sync_sanitize. | |
*/ | |
function MY_MODULE_drush_sql_sync_sanitize($source) { | |
// Sanitize username | |
$users_query = "UPDATE users SET name = CONCAT('name', uid) WHERE uid > 1;"; | |
drush_sql_register_post_sync_op('sanitise_users_name', dt('Sanitise users name field'), $users_query); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Preprocess and suggestions for a Drupal sub-theme. | |
* | |
*/ | |
use Drupal\block\Entity\Block; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
excludes: | |
# General | |
- vendor | |
# Drupal 8 | |
- web | |
- '!web/sites' | |
- '!web/modules/custom' | |
- '!web/themes/custom' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# Get field_text #} | |
{{ content.field_text }} | |
{# Get content of field_text #} | |
{{ content.field_text.0 }} | |
{# Get the path of an image / file #} | |
{{ file_url(content.field_image[0]['#media'].field_media_image.entity.uri.value) }} | |
{# Get the alt value of an image #} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Compress a folder with an exclude | |
tar --exclude='folder/exclude' -czvf filename.tar.gz folder/ | |
# Compress a folder with progress bar (https://superuser.com/a/665181) | |
tar cf - /folder/to/compress -P | pv -s $(($(du -sk /folder/to/compress | awk '{print $1}') * 1024)) | gzip > filename.tar.gz | |
# Display disk usage in a summarized and human readable output | |
du -h -d1 /path | |
# Find files older than 7 days |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Calculate the size of each database | |
## Order by name | |
SELECT | |
table_schema AS `Database`, | |
ROUND((SUM(data_length + index_length) / 1024 / 1024), 2) AS `Size in MB` | |
FROM | |
information_schema.tables | |
GROUP BY | |
table_schema |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace common\components; | |
/** | |
* ClientScriptView class file. | |
* | |
* @author Tsunu {@link http://www.yiiframework.com/forum/index.php/topic/24429-the-best-way-to-write-javascript/page__p__118436#entry118436} | |
* @author MGHollander {@link https://github.com/MGHollander} | |
* @version 1.1 | |
*/ |