This file contains hidden or 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
'use strict' | |
const http = require('http') | |
const port = 3000 | |
http | |
.createServer((request, response) => { | |
// Set CORS headers | |
response.setHeader('Access-Control-Allow-Origin', '*'); | |
response.setHeader('Access-Control-Request-Method', '*'); |
This file contains hidden or 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 | |
if ( !function_exists( 'translate_all_media' ) ) { | |
function translate_all_media() { | |
global $polylang; | |
if(!$polylang) return; | |
// find languages | |
$langs = array(); |
This file contains hidden or 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 | |
if(!function_exists('get_url_by_template')){ | |
function get_url_by_template($tmpl){ | |
$pages = query_posts(array( | |
'post_type' =>'page', | |
'meta_key' =>'_wp_page_template', | |
'meta_value'=> $tmpl | |
)); |
This file contains hidden or 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 | |
// filter to remove TinyMCE emojis | |
if ( !function_exists( 'disable_emojicons_tinymce' ) ) { | |
function disable_emojicons_tinymce( $plugins ) { | |
if ( is_array( $plugins ) ) { | |
return array_diff( $plugins, array( 'wpemoji' ) ); | |
} else { | |
return array(); | |
} |
This file contains hidden or 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
/** | |
* Fade in/out an element | |
* Note: I am not using requestAnimationFrame as it does not play well in mobile browsers | |
* | |
* @param {Object} [options={}] An object with options. | |
* @param {Element} [options.el] The Element object. | |
* @param {String} [options.type='in'] The fade type: 'in' or 'out'. | |
* @param {Integer} [options.duration=400] The duration of the animation in miliseconds. | |
* @param {String} [options.display='block'] The display property of the element when fade in starts. | |
* @param {Boolean} [options.empty=false] Set to true if you need to empty the element after fade out. |
This file contains hidden or 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
String.prototype.detonify = function () { | |
'use strict'; | |
// set string of characters with tones | |
let tones = 'ΆάΈέΉήΌόΎύΏώΊΪϊίΫϋ'.split('') | |
// set the equivalent string of characters without tones | |
let detones = 'ΑαΕεΗηΟοΥυΩωΙΙιιΥυ'.split('') | |
let str = this.toString() | |
for (let key in tones) { | |
let regex = new RegExp(tones[key], 'g') | |
str = str.replace(regex, detones[key] || tones[key]) |
This file contains hidden or 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 | |
/* | |
*Template Name: Skroutz XML | |
*/ | |
/* | |
* This Wordpress template generates a xml feed for skroutz.gr | |
*/ | |
header ("Content-Type:text/xml"); |
This file contains hidden or 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 | |
/** | |
* This is a custom validation for Ultimate Members Wordpress plugin | |
* Apply custom validation to VAT field with the name vat_number | |
* It requires also a country field | |
* This expects a user to enter a VAT Number in the following format: | |
* EL-123456789 | |
* | |
* Add um_custom_vat_validation on Custom Action field |