Skip to content

Instantly share code, notes, and snippets.

View montrealist's full-sized avatar
📺

Max Kovalenkov montrealist

📺
  • Montreal
View GitHub Profile
@montrealist
montrealist / deploy-to-digital-ocean.markdown
Last active January 7, 2024 11:57
How to deploy files to Digital Ocean when pushing to Gitlab

How to get auto-deploy working from Gitlab to your Digital Ocean (DO) server.

Install https://github.com/olipo186/Git-Auto-Deploy (via apt-get):

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:olipo186/git-auto-deploy
sudo apt-get update
sudo apt-get install git-auto-deploy
#!/bin/bash
#
# Bash script to setup headless Selenium (uses Xvfb and Chrome)
# (Tested on Ubuntu 12.04) trying on ubuntu server 14.04
# Add Google Chrome's repo to sources.list
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list
# Install Google's public key used for signing packages (e.g. Chrome)
# (Source: http://www.google.com/linuxrepositories/)
@montrealist
montrealist / how-to-get-wp_mock-working-inside-codeception.md
Last active July 13, 2016 18:45
How to get wp_mock set up inside Codeception
@montrealist
montrealist / custom.js
Created January 5, 2016 21:31
custom.js
console.log('custom shit: '); //TODO
var $list = $( '.products' ),
$items = $list.find( '.product' ),
setHeights = function()
{
$items.css( 'height', 'auto' );
var perRow = Math.floor( $list.width() / $items.width() );
if( perRow == null || perRow < 2 ) return true;
for( var i = 0, j = $items.length; i < j; i += perRow )
@montrealist
montrealist / wp-revslider-import-error.md
Last active October 1, 2023 15:39
WordPress revslider error: slider_export.txt does not exist - Solution

WordPress revslider: slider_export.txt does not exist

problem:

The Slider Revolution WordPress plugin (version 5.1 and earlier) produces an error when one tries to export a slider, and then import the resulting ZIP file into another WordPress installation. The error verbatim:

importing slider settings and data...
Error: slider_export.txt does not exist!

issue:

@montrealist
montrealist / epc-csv-export.php
Created November 9, 2015 19:11
WordPress plugin to generate CSV from postmeta table data (in this case - average star ratings from the Starstruck plugin
<?php
/**
* CSV Exporter bootstrap file
*
* This file is read by WordPress to generate the plugin information in the plugin
* admin area. This file also includes all of the dependencies used by the plugin,
* registers the activation and deactivation functions, and defines a function
* that starts the plugin.
*
@montrealist
montrealist / .gitignore
Last active October 25, 2015 21:28
.gitignore for wpengine projects
*~
.DS_Store
.svn
.cvs
.git
.listing
*.bak
*.swp
Thumbs.db
*.log
$whereami = dirname(__FILE__);
if ( preg_match('/htdocs/',$whereami) ) { // local
//print('I am localhost!'); exit;
define( 'WP_SITEURL', 'http://localhost/epicsky' ); /*TODO remove this */
define( 'WP_HOME', 'http://localhost/epicsky' ); /*TODO remove this */
}else if(preg_match('/liroca/',$whereami)) { // dev
define( 'WP_SITEURL', 'http://epicsky.liro.ca' );
define( 'WP_HOME', 'http://epicsky.liro.ca' );
}else { //prod
@montrealist
montrealist / fn-get-default-image-for-post.php
Created September 8, 2015 17:38
WordPress Options Framework, and Polylang - given a post ID, return a URL for a default image specified in admin options.
unction get_default_image_for_post($post_id){
if(!$post_id) { return false; }
global $smof_data;
//error_log('smof_data:');
//error_log(print_r($smof_data,true));
$thumb_url = false;
$prefix = 'mxp_';
@montrealist
montrealist / sp-email-signature.html
Last active August 29, 2015 14:25
santropol e-mail signature template
<a href="http://www.santropolroulant.org/"><img src="http://santropolroulant.org/wp-content/sp-att-images/logo-roulant-low.jpg"></a>
<br><br>
<font color="#504e4f">
<b>[name]</b>
<br>
<i>[title in French]