Skip to content

Instantly share code, notes, and snippets.

View montrealist's full-sized avatar
📺

Max Kovalenkov montrealist

📺
  • Montreal
View GitHub Profile

Contract Killer 3

Revised date: 07/11/2012

Between me [company name] and you [customer name]

Summary:

I'll always do my best to fulfil your needs and meet your expectations, but it's important to have things written down so that I both know what's what, who should do what and when, and what will happen if something goes wrong. In this contract you won't find any complicated legal terms or long passages of unreadable text. I've no desire to trick you into signing something that you might later regret. What I do want is what's best for both parties, now and in the future.

@montrealist
montrealist / acf_repeater_data_insert_update
Created February 27, 2013 21:39
How to programmatically insert and update Advanced Custom Fields (ACF) repeater data
<?php
$acf_group_title = 'custom-fields-for-event';
$acf_field_title = 'event_ticket_info';
$acf_field_key = '';
$data_to_insert = array(array("sub_field_1" => "Foo1", "sub_field_2" => "Bar1"), array("sub_field_1" => "Foo2", "sub_field_2" => "Bar2"));
$acf_args = array(
'post_type' => 'acf',
'posts_per_page' => 1,
@montrealist
montrealist / wp-quare-shortcode-bug
Last active December 15, 2015 19:48
Table shortcode generation bug in the Wordpress Quare theme (http://quare.themeple.co/) - only first table row gets properly wrapped with a `<tr>`, the rest of them do not. Check the revisions to see how it's fixed.
if(!function_exists('themeple_str_lreplace')){
function themeple_str_lreplace($search, $replace, $subject)
{
$pos = strrpos($subject, $search);
if($pos !== false)
{
$subject = substr_replace($subject, $replace, $pos, strlen($search));
}
@montrealist
montrealist / install_memcache_on_mac_osx.sh
Created January 9, 2015 01:06
How to install memchache module on Mac OS X 10.9 running MAMP (or Apache)
# 1. Install brew (http://brew.sh/)
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# 2. Drop php_info() into the home directory of your MAMP-run site and find out your PHP version. Mine was 5.6.2.
# 3. Install appropriate version of memcache using Brew (also install memcache just in case):
brew install memcache
brew install php56-memcache
@montrealist
montrealist / Language-slug-instead-of-name-in-PolyLang-WordPress
Created January 26, 2015 23:37
A filter allowing to output a shorter language slug instead of a language name in Polylang plugin on WordPress.
// put this in functions.php:
if ( ! function_exists( 'tco_switcher_language_name' ) ) :
function tco_switcher_language_name($args = '') {
$args['display_names_as'] = 'slug';
return $args;
}
add_filter('pll_the_languages_args','tco_switcher_language_name');
endif;
'use strict';
/**
* services.cordova Module
*
* General Cordova services module
*/
angular.module('bili.services.cordova')
@montrealist
montrealist / gist:986c21df5ebfda8fa581
Last active August 29, 2015 14:20
Macro created for migrating a WordPress site from QTranslate/mQtranslate plugin onto Polylang. Prerequisites: CSV in a specific format ("post_url","title_in_new_language","N/A","year","month","day","hour","minute"); having Polylang plugin activated; being logged in to the WordPress site. The macro traverses a CSV file with URLs, opens them, clic…
VERSION BUILD=8070701 RECORDER=CR
SET !ERRORIGNORE YES
SET !EXTRACT_TEST_POPUP NO
SET !DATASOURCE urls_and_dates.csv
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO={{!COL1}}
SET !EXTRACTADD {{!URLCURRENT}}
SET !EXTRACTADD {{!COL1}}
@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]
@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_';
$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