Skip to content

Instantly share code, notes, and snippets.

View INDIAN2020's full-sized avatar

Gogula Sivannarayana INDIAN2020

View GitHub Profile
@INDIAN2020
INDIAN2020 / NewPasswordType.php
Created September 24, 2018 18:09 — forked from florentdestremau/NewPasswordType.php
A simple User authentication setup to copy & paste into your Symfony 3.4 install
<?php
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
@INDIAN2020
INDIAN2020 / Backup site plan.txt
Created September 24, 2018 17:36
SYSADMIN: Collection of useful commands and configs
#### Backup web directories ####
cd /data/web/; for i in */; do tar -cvzf "${i%/}-$(date '+%Y%m%d').backupgd.tar.gz" "$i"; done;
find / -iname "*.backupgd.tar.gz" -exec mv {} /data/backups/web \;
#### Backup sql ####
sudo service mysql stop;
sudo mysqld_safe --skip-grant-tables &
cd /data/backups/sql;
for I in $(mysql -u root -e 'show databases'); do mysqldump -u root $I | gzip > "$I.sql.gz"; done;
#find . -type f -name '*.sql.gz' -exec mv {} /data/backups/sql \;
# Default extension package
sudo apt-get install libxml2-dev libbz2-dev libmcrypt-dev libreadline-dev libxslt1-dev autoconf -y
# Default extension package (18.04)
sudo apt-get install libssl-dev
# +apxs2
sudo apt-get install apache2-dev -y
# +gd (14.04)
sudo apt-get install -y libfreetype6 libfreetype6-dev libpng12-0 libpng12-dev libjpeg-dev libjpeg8-dev libjpeg8 libgd-dev libgd3 libwebp-dev
@INDIAN2020
INDIAN2020 / rename-mu-plugins-folder.php
Created June 18, 2018 07:50 — forked from yanknudtskov/rename-mu-plugins-folder.php
Rename Must Use Plugins Folder In this case it's set relative to the plugins folder.
define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/new-name' );
@INDIAN2020
INDIAN2020 / change-mu-plugins-folder.php
Created June 18, 2018 07:50 — forked from yanknudtskov/change-mu-plugins-folder.php
Change location the Wordpress Must Use Plugin Folder (mu-plugins)
define( 'WPMU_PLUGIN_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/path/to/mu-plugins' );
@INDIAN2020
INDIAN2020 / move-plugins-folder.php
Created June 18, 2018 07:50 — forked from yanknudtskov/move-plugins-folder.php
Move the WordPress Plugin Directory So far we have assumed your plugin directory will be staying inside the content directory, but it doesn’t have to. To ensure maximum compatibility with properly coded plugins, be sure to set both the WP_PLUGIN_DIR and WP_PLUGIN_URL constant. WP_PLUGIN_DIR is the path relative to wp-config’s location and WP_PLU…
define( 'WP_PLUGIN_DIR', dirname(__FILE__) . '/path/to/plugins' );
define( 'WP_PLUGIN_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/path/to/plugins' );
@INDIAN2020
INDIAN2020 / move-wp-content-folder.php
Created June 18, 2018 07:50 — forked from yanknudtskov/move-wp-content-folder.php
Move the Wordpress Content Folder This new, more easily accessible wp-content folder will be used instead of the one in the WordPress directory. This will mean you will lose access to the default themes. You can either manually move them to the new content directory or you can register the original wp-content folder using register_theme_director…
define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . 'path/to/wp-content' );
define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/path/to/wp-content' );
@INDIAN2020
INDIAN2020 / move-wp-config.php
Created June 18, 2018 07:50 — forked from yanknudtskov/move-wp-config.php
Move the Wordpress Configuration File
define('ABSPATH', dirname(__FILE__) . '/');
require_once(ABSPATH . '../path/to/wp-config.php');
add_action( 'pre_get_posts', 'set_posts_per_page' );
function set_posts_per_page( $query ) {
global $wp_the_query;
if ( ( ! is_admin() ) && ( $query === $wp_the_query ) && ( $query->is_search() ) ) {
$query->set( 'posts_per_page', 3 );
}
elseif ( ( ! is_admin() ) && ( $query === $wp_the_query ) && ( $query->is_archive() ) ) {
$query->set( 'posts_per_page', 5 );
@INDIAN2020
INDIAN2020 / set-default-editor.php
Created June 18, 2018 07:43 — forked from yanknudtskov/set-default-editor.php
Set Default Editor Do you prefer to use the HTML editor rather than the Visual Editor when writing posts? Make either of these options your default by adding either of the following lines to your functions.php file:
# Visual Editor as default
add_filter( 'wp_default_editor', create_function('', 'return "tinymce";') );
# HTML Editor as default
add_filter( 'wp_default_editor', create_function('', 'return "html";') );