Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View andreasciamanna's full-sized avatar

Andrea andreasciamanna

View GitHub Profile
@andreasciamanna
andreasciamanna / fix-start-date-in-gantt-chart.js
Last active August 16, 2022 10:44
Fix start date in Gantt chart
/*jshint esversion: 6 */
const entities = require('@jetbrains/youtrack-scripting-api/entities');
const http = require('@jetbrains/youtrack-scripting-api/http');
const knownGanttIssues = {};
const connection = new http.Connection('https://<URL_TO_API>');
connection.addHeader('Content-Type', 'application/json;charset=UTF-8');
connection.addHeader('Authorization', 'Bearer <aUTH_TOKEN>');
@andreasciamanna
andreasciamanna / wpml-notify-on-post-updates.php
Last active June 17, 2020 12:24
Send an email when an original post with translations is updated
<?php
/*
Plugin Name: WPML Notify on Post Updates
Plugin URI: http://wpml.org
Description: Sends an email when an original post with translations is updated.
Version: 0.0.1
Author: Andrea Sciamanna
Author URI: https://www.onthegosystems.com/team/andrea-sciamanna/
*/
### Keybase proof
I hereby claim:
* I am andreasciamanna on github.
* I am andreasciamanna (https://keybase.io/andreasciamanna) on keybase.
* I have a public key ASAkRiyD1VpmwcVneTHO1SlTfkIMbmc5ljx9D02wxnKnCQo
To claim this, I am signing this object:
@andreasciamanna
andreasciamanna / phpcs.json
Created March 15, 2019 15:04
phpcs.json from CI
{
"totals": {
"errors": 39,
"warnings": 7,
"fixable": 12
},
"files": {
"\/builds\/wpml\/sitepress-multilingual-cms\/sitepress.php": {
"errors": 39,
"warnings": 7,
@andreasciamanna
andreasciamanna / simple-sorting.php
Created February 14, 2019 08:36
Simple sorting
<?php
function sort_modules_by_position_only_A( $a, $b ) {
return (int) $a->position - (int) $b->position;
}
function sort_modules_by_position_only_B( $a, $b ) {
return ( (int) $a->position < (int) $b->position ) ? -1 : 1;
}
Assignee: me Type: -Defect State: Done Changelog entry: {No changelog entry}
AND (
(project: wpmlcore AND Fix Versions: 3.8.0) OR
(project: wpmltm AND Fix Versions: 2.4.0) OR
(project: wpmlst AND Fix Versions: 2.6.0) OR
(project: wpmlmedia AND Fix Versions: 2.2.1) OR
(project: wpmlsl AND Fix Versions: 1.4.2) OR
(project: wpmlcmsnav AND Fix Versions: 1.4.21) OR
(project: gfml AND Fix Versions: 1.3.16)
)
@andreasciamanna
andreasciamanna / WPML_SEO_HeadLangs_head_langs.php
Created April 6, 2016 16:02
\WPML_SEO_HeadLangs::head_langs
<?php
function head_langs() {
$languages = $this->sitepress->get_ls_languages( array( 'skip_missing' => true ) );
$languages = apply_filters( 'wpml_head_langs', $languages );
// If there are translations and is not paged content...
//Renders head alternate links only on certain conditions
$the_post = get_post();
$the_id = $the_post ? $the_post->ID : false;
$is_valid = is_array( $languages ) && count( $languages ) > 1 && ! is_paged() && ( ( ( is_single() || is_page() ) && $the_id && get_post_status( $the_id ) === 'publish' ) || ( is_home() || is_front_page() || is_archive() ) );
<?php
function wpml_the_content_filter( $content ) {
global $post, $sitepress;
$element_type = 'post_' . $post->post_type;
$trid = $sitepress->get_element_trid( $post->ID, 'post_' . $post->post_type );
$element_translations = apply_filters( 'wpml_get_element_translations', null, $trid, $element_type );
$translation_type = apply_filters( 'wpml_element_translation_type', null, $post->ID, $post->post_type );
[user]
name = FULL NAME
email = email@address.tld
logallrefupdates=true
[core]
#MANDATORY!!!
#Use `true` instead of `input` in Windows environments
autocrlf = input
@andreasciamanna
andreasciamanna / api_response_example.php
Created June 19, 2014 21:51
Example of how we handle API responses
<?php
/*
Example of a json response object:
{
"response": { //Whatever is expected to be returned
"id": 11,
"firstName": "Woody",