Skip to content

Instantly share code, notes, and snippets.

View Neolot's full-sized avatar
🏠
Make the web great again

Yurii Pokhylko Neolot

🏠
Make the web great again
View GitHub Profile
@Neolot
Neolot / gist:3964376
Created October 27, 2012 11:44
WORDPRESS Custom excerpt more
function excerpt_more($more) {
return '...';
}
add_filter('excerpt_more', 'excerpt_more');
@Neolot
Neolot / gist:3964380
Last active July 30, 2024 16:02
PHP Склонение числительных
<?php
/**
* Функция склонения числительных в русском языке
*
* @param int $number Число которое нужно просклонять
* @param array $titles Массив слов для склонения
* @return string
**/
$titles = array('Сидит %d котик', 'Сидят %d котика', 'Сидит %d котиков');
function declOfNum($number, $titles)
@Neolot
Neolot / gist:3964386
Created October 27, 2012 11:47
WORDPRESS Comment author's siteurl fix
function commentdataFix($commentdata) {
if ( $commentdata['comment_author_url'] == 'Site') {
$commentdata['comment_author_url'] = '';
}
return $commentdata;
}
add_filter('preprocess_comment','commentdataFix');
@Neolot
Neolot / jquery_tabs.css
Last active October 12, 2015 03:28
JQUERY Tabs
.tabs-wrapper .box {display: none;}
.tabs-wrapper .box.visible {display: block;}
@Neolot
Neolot / gist:5241844
Last active December 15, 2015 09:58
WORDPRESS Количество лайков по URL
<?php
/*
* Кол-во лайков по URL
*/
function getFBLikes($postID){
$cache = get_transient('likes_' . $postID);
if ( empty( $cache ) ){
$url = get_permalink($postID);
@Neolot
Neolot / gist:5709480
Created June 4, 2013 20:51
Reset CSS by Eric Meyer, minified
/***** Reset by Eric Meyer *****/
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;/*font:inherit;*/vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-collapse:collapse;border-spacing:0}
@Neolot
Neolot / gist:5833205
Created June 21, 2013 18:22
301 редирект с одного раздела на другой. Пригодится при переименовании разделов.
RewriteRule ^razdel_1(/.*|)$ http://domain.com/razdel_2/? [L,NC,R=301]
@Neolot
Neolot / gist:5895259
Created June 30, 2013 14:08
JQUERY Depcecated toggle function
jQuery.fn.extend({
toggle: function( fn ) {
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 );
@Neolot
Neolot / gist:6078663
Last active December 20, 2015 05:29
Возвращает числовое значение временного интервала
<?php
/*
Возвращает числовое значение временного интервала
1 - Рабочее время
2 - Нерабочее время
3 - Выходные
*/
$starthour = 9; // Время начала рабочего дня
$endhour = 18; // Время конца рабочего дня
@Neolot
Neolot / gist:6703439
Created September 25, 2013 17:56
Grayscale to color images on hover
img.grayscale{
filter: grayscale(100%);
-webkit-filter: grayscale(100%); /* For Webkit browsers */
filter: gray; /* For IE 6 - 9 */
-webkit-transition: all .6s ease; /* Fade to color for Chrome and Safari */
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 10+, Firefox on Android */
}
img.grayscale:hover{
filter: grayscale(0%);