This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
sshpass -p your-password ssh user@domain.tld mkdir -p /var/www/your-path/status/master/ | |
sshpass -p your-password rsync --progress -avzP /home/your-user/.cache/QualityAnalyzer/assets -e ssh user@domain.tld:/var/www/your-metrics/status/$current_branch/ > /dev/null | |
sshpass -p your-password rsync --progress -avzP /home/your-user/.cache/QualityAnalyzer/index.html -e ssh user@domain.tld:/var/www/your-metrics/status/$current_branch/ > /dev/null | |
/usr/bin/phpmd /var/www/VVV/www/site/public_html/wp-content/plugins/your-plugin/ xml /CodeatCS/codeat-phpmd.xml --exclude vendor,tests --reportfile /tmp/phpmd-analysis.xml | |
/home/your-user/.cache/QualityAnalyzer/bin/analyze analyze /var/www/VVV/www/site/public_html/wp-content/plugins/your-plugin/ --exclude=vendor,tests --exclude_analyzers=cpd,pdepend,checkst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function sortArrayByArray( $array, $orderArray ) { | |
$order = array(); | |
foreach ( array_keys( $array ) as $index ) { | |
foreach ( array_keys( $orderArray ) as $key ) { | |
$order[ $index ][ $key ] = $array[ $index ][ $key ]; | |
} | |
} | |
return $order; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Error For WP backend | |
Plugin URI: https://github.com/Mte90/ | |
Description: Wrap the PHP errors in the WP admin backend with the native notice | |
Author: Mte90 | |
Version: 1.0.0 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function table_from_array( $cols, $tableclass = 'info' ) { | |
$content = "<table class=\"" . $tableclass . "\">\n"; | |
$i = 1; | |
foreach ( $cols as $key => $value ) { | |
if ( !empty( $value ) ) { | |
$i++; | |
if ( $i % 2 === 0 ) { | |
$content .= "<tr>"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Dashboard Widget Activity Custom Post Type | |
Plugin URI: | |
Description: | |
Author: Daniele Mte90 Scasciafratte | |
Version: 1.0.0 | |
Author URI: http://mte90.net | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Download from https://bugzilla.mozilla.org/show_bug.cgi?id=926940 the development build with the WebSerial API | |
Screenshot: https://plus.google.com/u/0/+DanieleScasciafratteMte90Net/posts/EED6sbEt2zv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
It demonstrates how you can create your own API when using REST style | |
calls through the browser with CORS enabled. | |
Possible commands created in this shetch: | |
* "/arduino/digital/13" -> digitalRead(13) | |
* "/arduino/digital/13/1" -> digitalWrite(13, HIGH) | |
* "/arduino/analog/2/123" -> analogWrite(2, 123) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Based on http://jsfiddle.net/i_like_robots/W2DA8/ | |
(function(name, context, definition) { | |
if (typeof define === 'function' && define.amd) { | |
define(definition); | |
} | |
else if (typeof module !== 'undefined' && module.exports) { | |
module.exports = definition(); | |
} | |
else { |