Skip to content

Instantly share code, notes, and snippets.

View proweb's full-sized avatar

Sergey Mochalov proweb

View GitHub Profile
@homu9
homu9 / gist:7d68b59aeb24c6f02455b776263041a2
Created April 13, 2022 19:54
Bulk update plugins for runcloud
#!/bin/bash
# Change directory to /home
cd /home
# Iterate through all users directories
for user in * ; do
# For every webapp under the user directory
# Count wp-config files to make sure its Wordpess
@MatthieuScarset
MatthieuScarset / gist:47b57f2e3bd4afee39a81ae5a7c3dc28
Created December 27, 2016 14:14
Drupal 8 - Get canonical node URL in TWIG
{{ path('entity.node.canonical', {'node': node.id }) }}
@soderlind
soderlind / change-theme-root.php
Last active April 2, 2022 15:50
Change WordPress theme root to a folder in your plugin (src/assets)
<?php
/**
* Sample use:
* WordPres Customizer is dependant on functionality in the theme. Just in case
* the current theme doesn't support WordPress Customizer we'll use a theme
* that supports it.
*/
class NN {
private $theme_name = 'twentysixteen';
@nternetinspired
nternetinspired / gist:7482445
Last active February 24, 2022 17:20
Load Disqus comments only on demand if you give a shit about page weight and your visitors. Even with no comments, i.e. an empty comment form, calling Disqus will load an extra 226Kb. If your page has comments this can be far higher. This Gist accompanies my blog post: http://internet-inspired.com/wrote/load-disqus-on-demand/
// Requires jQuery of course.
$(document).ready(function() {
$('.show-comments').on('click', function(){
var disqus_shortname = 'YOUR-DISQUS-USERNAME'; // Replace this value with *your* username.
// ajax request to load the disqus javascript
$.ajax({
type: "GET",
url: "http://" + disqus_shortname + ".disqus.com/embed.js",
dataType: "script",
@schmidt1024
schmidt1024 / template-snippets.txt
Last active December 14, 2021 19:52
Template Snippets for Joomla!
# all php files :: disallow direct access of file
# between <?php and ?>
defined('_JEXEC') or die;
# index.php :: define variable with application
# between <?php and ?>
$app = JFactory::getApplication();
# index.php :: define variable with document
# between <?php and ?>
#!/bin/bash
# Regolith aka Un-Bedrock
# "But what if we need to hand it off to another agency?" No more!
# This script converts a Bedrock site to a normal WordPress structure.
# Run it from the root of a Bedrock project.
# Created by Nathan Knowler and Daniel Roe
echo "Converting Bedrock to a normal WordPress file structure..."
@renekreijveld
renekreijveld / jfindfiles
Last active March 11, 2021 07:03
Find unused and used content files in your Joomla website
#!/bin/sh
# jfindfiles -- Find used and unused content files in your Joomla website
#
# This scripts supports Joomla versions 2.5 - 3.x
#
# Copyright 2014 Rene Kreijveld - email@renekreijveld.nl
#
# This program is free software; you may redistribute it and/or modify it.
#
@tomazzaman
tomazzaman / class-watermark-image.php
Created April 7, 2015 19:30
Watermarking uploads in WordPress with Imagemagick
function register_watermarked_size() {
add_image_size( 'watermarked', 550, 550, true ); // This is what should be uploaded
}
add_action( 'init', 'register_watermarked_size' );
class Watermark_Image {
// The attachment meta array
public $meta = array();
@srikat
srikat / test.html
Created May 8, 2018 06:48
Dummy Content for Gutenberg
<!-- wp:heading -->
<h2>Heading Block (H2)</h2>
<!-- /wp:heading -->
<!-- wp:heading -->
<h3>You are looking at one. (H3)</h3>
<!-- /wp:heading -->
<!-- wp:heading -->
<h2>Subhead Block</h2>
@dongilbert
dongilbert / namespace.php
Last active May 12, 2019 11:25
Joomla Namespace Compatibility Layer
<?php
return array(
'JAccess' => 'Joomla\\Access\\Access',
'JAccessRule' => 'Joomla\\Access\\Rule',
'JAccessRules' => 'Joomla\\Access\\Rules',
'JApplicationBase' => 'Joomla\\Application\\Base',
'JApplicationCli' => 'Joomla\\Application\\Cli',
'JApplicationDaemon' => 'Joomla\\Application\\Daemon',
'JRoute' => 'Joomla\\Application\\Route',