Skip to content

Instantly share code, notes, and snippets.

View xeiter's full-sized avatar

Anton Zaroutski xeiter

View GitHub Profile
@xeiter
xeiter / 0_reuse_code.js
Created December 17, 2015 21:03
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
$all_forms = RGFormsModel::get_forms( null, 'title' );
$form_options = array();
foreach ( $all_forms as $form ) {
$form_options[ $form->title ] = $form->id;
}
@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>' );
@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 / 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 / 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 / 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 / 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(
# 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 / .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