Skip to content

Instantly share code, notes, and snippets.

View Krykunov's full-sized avatar
🏠
Working from home

Ihor Krykunov Krykunov

🏠
Working from home
View GitHub Profile
@Krykunov
Krykunov / try-catch.ts
Created March 20, 2025 08:17 — forked from t3dotgg/try-catch.ts
Theo's preferred way of handling try/catch in TypeScript
// Types for the result object with discriminated union
type Success<T> = {
data: T;
error: null;
};
type Failure<E> = {
data: null;
error: E;
};
@Krykunov
Krykunov / php
Created February 11, 2020 11:24
Make sure Polylang copies the content ant title when creating a translation
<?php
// Make sure Polylang copies the content when creating a translation
function jb_editor_content( $content ) {
// Polylang sets the 'from_post' parameter
if ( isset( $_GET['from_post'] ) ) {
$my_post = get_post( $_GET['from_post'] );
if ( $my_post )
return $my_post->post_content;
}
@Krykunov
Krykunov / multi-layer-shadow.css
Created December 24, 2018 14:18
multi-layer shadow
.todo-list {
background-color: white;
margin: auto;
width: 50%;
display: flex;
flex-direction: column;
align-items: center;
border: 1px solid #efefef;
box-shadow:
@Krykunov
Krykunov / gist:b8ea11e85147d97fbb5b317e66528401
Last active November 24, 2019 11:18
[WP_Query and Pagination on a Static front page] #Wordpress #php
<?php
$paged = ( get_query_var( 'page' ) ) ? get_query_var( 'page' ) : 1;
$query = new WP_Query( array(
'posts_per_page' => 13,
'paged' => $paged
) );
?>
<?php if ( $query->have_posts() ) : ?>
@Krykunov
Krykunov / Add_Open_Bash_context_menu.reg
Last active December 15, 2018 13:25
Добавление пункта "Открыть окно Bash здесь" для работы с Ubuntu shell в текущей папке Windows 10
Windows Registry Editor Version 5.00
; Created by:Shawn Brink
; Created on: August 13th 2016
; Tutorial: http://www.tenforums.com/tutorials/60125-open-bash-window-here-context-menu-add-windows-10-a.html
[HKEY_CLASSES_ROOT\Directory\Background\shell\Bash]
@="Open Ubuntu Bash window here"
/**
* The theme header.
*
* @link https://developer.wordpress.org/themes/basics/template-files/#template-partials
*
* @license GPL 2.0
*/
@Krykunov
Krykunov / button.sass
Created December 10, 2017 19:20 — forked from agragregra/button.sass
Button Sass Styles (Universal Starter)
.button
display: inline-block
border: none
color: #fff
text-decoration: none
background-color: $accent
padding: 15px 45px
font-size: 13px
text-transform: uppercase
font-weight: 600
@Krykunov
Krykunov / WordPress query_posts
Created August 9, 2015 10:31
WordPress query_posts
<?php if ( have_posts() ) : query_posts('p=1');
while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php the_post_thumbnail(array(100, 100)); ?>
<? endwhile; endif; wp_reset_query(); ?>
function heightDetect(){
$(".main_head").css("height", $(window).height());
};
heightDetect();
$(window).resize(function() {
heightDetect();
});
@Krykunov
Krykunov / jQueryPagePreload
Created July 24, 2015 08:01
jQuery Page Preload
#loader {
background: none repeat scroll 0 0 #ffffff;
bottom: 0;
height: 100%;
left: 0;
position: fixed;
right: 0;
top: 0;
width: 100%;
z-index: 9999;