Instantly share code, notes, and snippets.

View replace-po-wp-to-cp.sh
#/bin/bash
locale=$1
function replace() {
sed -i.bak s/WordPress/ClassicPress/g /tmp/$1-$2.po
sed -i.bak s/ClassicPress.org/ClassicPress.net/g /tmp/$1-$2.po
}
wget https://translate.wordpress.org/projects/wp/4.9.x/$locale/default/export-translations -O /tmp/$locale-1.po
View freemius-to-slack.php
<?php
// Get Freemius data
$json = file_get_contents('php://input');
$data = json_decode($json, true);
if( isset( $data['objects'] ) ) {
slack($data);
}
function slack($data) {
View Readme.md

This set of script is used to manipulate the stuff to upload on common voice.

Usually the procedure is to check the sentences, later with prepare_for_pipe.sh is added the pipe for newlines, create_pipe.sh add the pipes and made a counter of the actual status of this strings.

With only_italian.py instead we extract only the sentences for italian to manipulate later after a manual check of every line as example for links.

View scripts.js
// This automatically click on yes on all of the three buttons to speed the procedure
jQuery('.form-item-field-moderation-personalized:nth-child(2) label, .form-item-field-moderation-issue-addressed:nth-child(2) label, .form-item-field-moderation-positive-tone:nth-child(2) label ').trigger('click')
View pre-push.sh
#!/bin/sh
# If the branch is not master, execute phpmetrics and upoload everything on the VPS
current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')
if [ $current_branch != "master" ]; then
phpmetrics --report-html="/tmp/your-report" /var/www/VVV/www/your-project/htdocs/wp-content/plugins/your-plugin/ --config=phpmetrics.ini > /dev/null
sshpass -p your-password rsync --exclude={.sass-cache*,*.map,node_modules,.php_cs,.git*,*.lock,*.yml,*lock.json} --progress -avz /tmp/your-report -e ssh user@domain.tld:/var/www/your-metrics/$current_branch/ > /dev/null
fi
View freemius.php
<?php
echo "Parsing Freemius Webhook";
// Get Freemius data
$json = file_get_contents('php://input');
$data = json_decode($json, true);
if( isset($data['objects']['user']) ) {
// Let's call our opensupports instance
$name = $data['objects']['user']['first'] . ' ' . $data['objects']['user']['last'];
View snippet.php
<?php
/*
* Plugin Name: Better errors
* Description: Better errors in log
* Author: Daniele Scasciafratte
* Version: 1.0
* Author URI: http://codeat.co
*/
function handleError($code, $description, $file = null, $line = null, $context = null) {
View vim.sh
#!/bin/bash
cd ./vim-qt/src
make clean
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-python3interp=yes \
--enable-largefile \
--disable-netbeans \
View wp-mysql-test.php
<?php
/**
* Database connection test script for WordPress
*
* Parses the wp-config.php file for DB connection information and tests
* a mysql connection to the DB server and selection of the database.
* Errors will be reported. Attempts will be made to repair table errors.
*
* Place this file in the same directory as wp-config.php
View gist:a94e6fb73f68f0958809308dea94c2d3
---
sites:
boilerplate:
repo: https://github.com/JPry/vvv-base.git
custom:
delete_default_plugins: true
nginx_upstream: php71
hosts:
- boilerplate.dev