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
#!/bin/bash | |
# Example run: ./optimize-images.sh -path /var/www/vhost/domain.nl -mtime 2 | |
# Example run with exclude: ./optimize-images.sh -path /var/www/vhost/domain.nl -mtime 2 -exclude "*/exclude_dir/*" | |
mtime='2' | |
path='' | |
exclude='' | |
find_path="$(which find)" | |
optipng_path="$(which optipng)" | |
jpegoptim_path="$(which jpegoptim)" |
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
#!/bin/bash | |
# Example run: ./webp-convert.sh /var/www/vhost/domain.nl/webroot | |
# cleanup, remove webp if jpg/png version does not exist or jpg/png is newer then webp version | |
echo -e "\033[0;34mCleaning up WEBP images\033[0m" | |
find $1 -type f -and -iname "*.webp" | while read webpFile; do | |
echo "Processing file '$webpFile'" | |
basename="${webpFile%.*}" | |
# Check if original file still exists. |
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
sudo add-apt-repository ppa:ondrej/php | |
sudo apt-get update | |
sudo apt-get install | |
php7.2 | |
php7.2-common | |
php7.2-cli | |
php7.2-fpm | |
php7.2-opcache | |
php7.2-mysql | |
php7.2-zip |
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 | |
function findAll($search_str, $database, $types = ['tinytext','blob','varchar','text','longblob']){ | |
global $pdo; | |
foreach($types as &$t){ | |
$t = "'" . $t . "'"; | |
} | |
$types = implode(',',$types); | |
$s = $pdo->prepare(" |
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
{ | |
xtype: 'modx-combo' | |
,width: 200 | |
,name: "id" | |
,id: config.id + '-user-field' | |
,url: MODx.config.connectorUrl | |
,fields: ['id', 'firstname', 'lastname'] | |
,tpl: '<tpl for="."><div class="x-combo-list-item" >{firstname} {lastname}</div></tpl>' | |
,displayField: 'firstname' | |
,baseParams: { |
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 | |
/** | |
* Get full parsed HTML from resource | |
* (you already need to have the resource object available in $this->resource) | |
* | |
* @access public | |
* @return string $html The parsed html of the resource | |
*/ | |
public function parseResource() { | |
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
``` | |
switch ($modx->event->name) { | |
case 'OnBeforeManagerPageInit': | |
$modx->controller->addHtml(' | |
<script> | |
Ext.ComponentMgr.onAvailable("modx-resource-tabs", function() { | |
// Order of tabs | |
var tabs = { | |
"modx-panel-resource-tv": null, | |
"modx-page-settings": null, |
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
, listeners: { | |
render: function(c) { | |
// first get count via ajax call | |
MODx.Ajax.request({ | |
url: className.config.connectorUrl, | |
params: { | |
action: 'mgr/group/getlist' | |
}, | |
listeners: { | |
'success': { |
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
* Example: Replace dash (-) to underscore (_) in name attribute * | |
search: | |
name="([a-zA-Z]*)-([a-zA-Z]*)-([a-zA-Z]*)" | |
replace: | |
name="\1_\2_\3" |
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
.parent { | |
float: left; | |
height: 200px; | |
width: 200px; | |
background: gray; | |
margin: 0 10px 0 0; | |
} | |
.children { | |
position: relative; | |
top: 50%; |
NewerOlder