Skip to content

Instantly share code, notes, and snippets.

View ideag's full-sized avatar

Arūnas Liuiza ideag

View GitHub Profile
<?php
add_filter( 'pre_http_request', 'arunas_proxy_wporg', 1, 3 );
function arunas_proxy_wporg( $response, $parsed_args, $url ) {
if ( 1 === preg_match( '|^https?://api.wordpress.org|ims', $url ) ) {
$url = preg_replace( '|^https?://api.wordpress.org|ims', 'http://localhost:10159', $url );
$response = wp_remote_request( $url, $parsed_args );
}
return $response;
}
@ideag
ideag / arunas-no-prefix-cpt.php
Last active March 22, 2020 15:03
Remove prefix from CPT URL
<?php
/*
* Plugin Name: Arunas' No Prefix for CPT
* Version: 1.0.0
* Description: Remove prefix from CPT URL
* Plugin URI: https://gist.github.com/ideag/60d4b1e6185e62fa9a903bcf600f8a95
* Author: Arūnas Liuiza
* Author URI: https://www.arunas.co/
*/
<?php
/**
* Plugin Name: Hello VDU
* Author: Arūnas Liuiza [KAYAK]
* Version: 0.1.0
* Text Domain: hello-vdu
*/
add_action( 'plugins_loaded', 'hello_vdu' );
@ideag
ideag / fontawesome.php
Created March 16, 2018 09:01
A more elaborate WordPress plugin to add FontAwesome icons via shortcode
<?php
/**
* Plugin Name: FontAwesome
* Version: 0.1.0
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
@ideag
ideag / fontawesome.php
Last active March 16, 2018 09:00
A simple plugin to add FontAwesome icons via shortcode
<?php
/**
* Plugin Name: FontAwesome
* Version: 0.1.0
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
@ideag
ideag / tinytemplate.php
Last active March 15, 2018 14:04
TinyTemplate
<?php
/**
* Plugin Name: TinyTemplate
* Version: 0.1.0
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
@ideag
ideag / ca-pageview.php
Last active January 3, 2018 13:24
CA Pageviews
<?php
/**
* Plugin Name: CodeAcademy Pageviews
* Author: Arūnas Liuiza
* Version: 0.3.0
*
* @package CA_Pageview
* @version 0.3.0
*/
@ideag
ideag / gist:072505ad297fa5e5fcdfcefec178a20c
Created October 27, 2017 20:11 — forked from farico/gist:3938084
Linksniavimas LT vardu
<?php
/**
* Lietuviškų vardų linksniai.
*
* @author Maug Lee <[email protected]>
* @copyright Copyleft (ↄ) 2011, Maug Lee
* @version 0.3
* @package Vardai
*/
@ideag
ideag / go.js
Last active October 27, 2017 14:58
scrape vardai
jQuery.ajaxSetup({async:false});
jQuery.each(jQuery('.namesList ul>li a'),function(no,link){
var name = jQuery(link).text().normalize('NFD').replace(/[\u0300-\u0303]/g, "").normalize('NFC');
jQuery.get(
'https://api.aru.lt/json/names/v1/'+name, {'v':2}
);
console.log(name);
});
@ideag
ideag / themes.js
Created September 21, 2017 10:02
Extract translation file links from WP themes directory
jQuery('.theme .url').each(function(){
var slug = jQuery(this).prop('href');
slug = slug.replace( 'https://wordpress.org/themes/', '' );
slug = slug.replace( '/', '' );
var pot = 'https://translate.wordpress.org/projects/wp-themes/'+slug+'/lt/default/export-translations';
// window.location = pot;
console.log(pot);
});