Skip to content

Instantly share code, notes, and snippets.

View xeiter's full-sized avatar

Anton Zaroutski xeiter

View GitHub Profile
@xeiter
xeiter / .htaccess
Created May 10, 2016 04:57
Pull WordPress assets from Production if they do not exist in the local environment
<IfModule mod_rewrite.c>
RewriteEngine on
# Attempt to load files from production if
# they're not in our local version
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule wp-content/uploads/(.*) \
http://{PROD}/wp-content/uploads/$1 [NC,L]
</IfModule>
<?php
/**
* Dynamically populate the values for Gravity Form drop downs
*
* @param array $form
* @return mixed
* @access public
*/
function az_gravityforms_dynamic_dropdown_values( $form ) {
@xeiter
xeiter / .bashrc
Created March 3, 2016 22:55
.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# List of messages in teh queue and get the MESSAGE_ID of the message
mailq | grep "search something"
# Read specific message by its MESSAGE_ID
postcat -q MESSAGE_ID
@xeiter
xeiter / functions.php
Created January 29, 2016 11:53
Adding custom content element to Visual Composer
<?php
add_action( 'vc_before_init', 'zaroutski_vc_register_banner_section_shortcode' );
/**
* Register banner section content element in Visual Composer
*/
function zaroutski_vc_register_banner_section_shortcode() {
vc_map( array(
@xeiter
xeiter / javascript_check_if_integer.js
Created January 23, 2016 11:07
Check if variable is an integer in JavaScript
if ( my_variable !== parseInt(my_variable, 10) ) { alert("my_variable is an integer"); }
@xeiter
xeiter / apache-enable-mod-rewrite.txt
Last active January 11, 2016 10:44
Enable mod_rewrite in Ubuntu
1) Run:
sudo a2enmod rewrite
2) Restart the webserver to apply the changes:
sudo service apache2 restart
3) Add the following to the virtual host configuration file /etc/apache2/sites-available
@xeiter
xeiter / mysql-import-dump
Created January 11, 2016 10:11
Import a dump file into MySQL database using command prompt
mysql -u username -ppassword databasename < filename.sql
@xeiter
xeiter / composer-install-wordpress.sh
Last active January 10, 2016 20:56
Install WordPress core using composer
composer create-project johnpbloch/wordpress-project my-site 0.1.3
@xeiter
xeiter / local-config.php
Last active January 10, 2016 21:18
WordPress - local configuration file
<?php
define( 'DB_NAME', '' );
define( 'DB_USER', '' );
define( 'DB_PASSWORD', '' );
define( 'DB_HOST', '127.0.0.1' );
define( 'WPLANG', '' );
define( 'WP_DEBUG', true );
define( 'SCRIPT_DEBUG', true );
define( 'WP_SITEURL', 'http://<domain-name>/wp' );
define( 'WP_HOME', 'http://<domain-name>' );