Skip to content

Instantly share code, notes, and snippets.

<?php
/**
Plugin Name: CLI Export Multisite
*/
if ( ! defined( 'WP_CLI' ) ) return;
use \WP_CLI\Utils;
/**
<?php
$apikey = ""; // Your API key
$workspace = ''; // your project's workspace ID
$project = ''; // your project's ID
$tasks = array(
'Task 1',
'Task 2',
'Task 3'
// etc
#!/usr/bin/env python
"""
To use this you have to include the task ID on the commit message.
Example: Fixing typo, #9283764018
You can as well close a task within the commit message.
Example: Improving the docs, closes #9823761989
"""
@bainternet
bainternet / post-commit
Last active August 29, 2015 14:19 — forked from brunohq/post-commit
#!/bin/bash
apikey=$(git config user.asana-key)
if [ $apikey == '' ] ; then exit 0; fi
comment=$(git log --pretty=oneline -n1)
taskid_pattern='.*#([0-9]*).*'
if [[ $comment =~ $taskid_pattern ]]; then
taskid=${BASH_REMATCH[1]}
apikey=$(git config user.asanakey)
function asanaRequest($methodPath, $httpMethod = 'GET', $body = null)
{
$apiKey = 'ASANA_API_KEY_HERE'; /// Get it from http://app.asana.com/-/account_api
$url = "https://app.asana.com/api/1.0/$methodPath";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ;
curl_setopt($ch, CURLOPT_USERPWD, $apiKey);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
<?php
/*
* Add "Formats" dropdown to TinyMCE Editor
*/
function matt2015_mce_formats($buttons) {
array_unshift($buttons, 'styleselect');
return $buttons;
}
add_filter('mce_buttons_2', 'matt2015_mce_formats');
<?php
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@bainternet
bainternet / gist:10577652
Last active August 29, 2015 13:59 — forked from webaware/gist:6260468
Add to cart with quantity from shop loop with ajax
<?php
/**
* start the customisation
*/
function custom_woo_before_shop_link() {
add_filter('woocommerce_loop_add_to_cart_link', 'custom_woo_loop_add_to_cart_link', 10, 2);
add_action('woocommerce_after_shop_loop', 'custom_woo_after_shop_loop');
}
add_action('woocommerce_before_shop_loop', 'custom_woo_before_shop_link');
@bainternet
bainternet / bitbucket-api.php
Created April 11, 2014 21:39
create bitbucket issue php api
<?php
/* Function submitBug - sends the bug to the bitbucket API. Must contain title and content. User name/email is optional.*/
function submitBug($title, $content, $user='Anonymous', $bbAccount, $bbRepo, $basicAuth, $component='', $status='new', $priority='major', $kind='bug'){
$url = 'https://api.bitbucket.org/1.0/repositories/'.$bbAccount.'/'.$bbRepo.'/issues/';
$ch = curl_init($url);
if (get_magic_quotes_gpc()) {
$title = stripslashes($title);
$content = stripslashes($content);
@bainternet
bainternet / new_gist_file.js
Created April 1, 2014 12:07
Contact form7 adwords tracking
on_sent_ok: "jQuery(String.fromCharCode(60)+'img/'+String.fromCharCode(62)).attr('height','1').attr('width','1').css('border-style','none').attr('src','REPLACE_THIS_WITH_YOUR_NOSCRIPT_SRC').appendTo('body');"