Skip to content

Instantly share code, notes, and snippets.

View tyxla's full-sized avatar
🏖️
Vacation

Marin Atanasov tyxla

🏖️
Vacation
View GitHub Profile
@tyxla
tyxla / pr.md
Created July 20, 2018 10:02 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

<?php
add_filter( 'gettext', 'dyad_translate_read_more_to_bg', 20, 3 );
function dyad_translate_read_more_to_bg( $translated_text, $text, $domain ) {
if ( $text === 'Read More' ) {
return 'Прочети още';
}
return $translated_text;
}
@tyxla
tyxla / gist:1685d1a60595ab6bd717abbafa3368e4
Created October 4, 2017 07:14
Remove empty lines between ES6 imports recursively in a directory (using multiline regex find and replace with perl)
find . -type f -exec perl -0777 -i -p -e 's/(import[^\n\r]+)[\n\r]{2,}(import[^\n\r]+)/\1\n\2/igs' {} +
@tyxla
tyxla / gist:fe296c9c7de428d43114dfd3d2086462
Last active May 17, 2024 12:35
Excel формула за транслитерация на кирилица към латиница - Excel formula for transliteration of Bulgarian Cyrillic to Latin
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(D2,"я", "ya"),"ю", "yu"),"ъ", "y"),"щ", "sht"),"ш", "sh"),"ч", "ch"),"ц", "c"),"х", "h"),"ф", "f"),"у", "u"),"т", "t"),"с", "s"),"р", "r"),"п", "p"),"о", "o"),"н", "n"),"м", "m"),"л", "l"),"к", "k"),"й", "y"),"и", "i"),"з", "z"),"ж", "j"),"е", "e"),"д", "d"),"г", "g"),"в", "v"),"б", "b"),"а", "a"),"Я", "Ya"),"Ю", "Yu"),"ь", "Y"),"Ъ", "Y"),"Щ", "Sht"),"Ш", "Sh"),"Ч", "Ch")
@tyxla
tyxla / custom-plugin.php
Created August 17, 2017 09:45
Custom WordPress Plugin
<?php
/**
* Plugin Name: My Test Plugin
* Plugin URI: https://wordpress.com/
* Description: Your custom description here
* Version: 1.0
* Author: WordPress.com
* Author URI: https://developer.wordpress.org/
*/
@tyxla
tyxla / grunion-editor-view.php
Last active August 10, 2017 10:41
Fix for JP contact form errors
<?php
/*
* A prototype to allow inline editing / editor views for contact forms.\
*
* Originally developed in: http://github.com/automattic/gm2016-grunion-editor
* Authors: Michael Arestad, Andrew Ozz, and George Stephanis
*/
class Grunion_Editor_View {
@tyxla
tyxla / insert-widget-in-sidebar.php
Created August 24, 2016 10:43
Insert a widget in a sidebar programmatically in WordPress
<?php
/**
* Insert a widget in a sidebar.
*
* @param string $widget_id ID of the widget (search, recent-posts, etc.)
* @param array $widget_data Widget settings.
* @param string $sidebar ID of the sidebar.
*/
function insert_widget_in_sidebar( $widget_id, $widget_data, $sidebar ) {
@tyxla
tyxla / compat-fix.php
Last active April 10, 2016 20:51
WP Hydra and Media Grid Wordpress Responsive Portfolio - compatibility fix
<?php
/*
Plugin Name: Media Grid Fix
Version: 1.0
*/
// global script enqueuing
remove_action('init', 'mg_global_scripts');
add_action('init', 'my_mg_global_scripts');
function my_mg_global_scripts() {
@tyxla
tyxla / page.php
Created February 24, 2016 07:31
Displaying nested complex Carbon Fields in the front-end templates
<?php $sections = carbon_get_post_meta( get_the_ID(), 'lk_section', 'complex' ); ?>
<?php if ( ! empty( $sections ) ): ?>
<?php foreach ( $sections as $section ): ?>
<section class="<?php echo esc_attr( $section['class'] ); ?>">
<?php if ( ! empty( $section['lk_row'] ) ): ?>
<?php foreach ( $section['lk_row'] as $row ): ?>
<div class="<?php echo esc_attr( $row['class'] ); ?>">
<?php if ( ! empty( $row['lk_column'] ) ): ?>
@tyxla
tyxla / main.js
Created February 17, 2016 08:05
Tabify Edit Screen + Carbon Fields compatibility - reopen first tab on load
jQuery(function($) {
$(window).on('load', function() {
var $firstTab = $('.tabify-tab:eq(0)');
if ($firstTab.length) {
$firstTab.trigger('click');
}
});
});