Skip to content

Instantly share code, notes, and snippets.

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

Stas karamansky

🏠
Working from home
View GitHub Profile
@karamansky
karamansky / Отлов пустых элементов на этапе верстки
Last active December 26, 2022 13:20
CSS: Отлов пустых элементов на этапе верстки
:empty:not(img):not(input) {
visibility: hidden;
opacity: .5;
outline: 4px solid #4ce00e;
}
@karamansky
karamansky / .gitignore WordPress
Last active December 26, 2022 13:19
WordPress: .gitignore
# ignore everything in the root except the "wp-content" directory.
/*
!wp-content/
# ignore everything in the "wp-content" directory, except:
# mu-plugins, plugins, and themes directories
wp-content/*
!wp-content/mu-plugins/
!wp-content/plugins/
!wp-content/themes/
@karamansky
karamansky / WordPress: Send email
Last active July 10, 2024 17:30
WordPress: Custom send email
public static function SendEmails(){
$message = 'User tried to log in with phone number: ' . 000 . '<br/>';
$headers = array(
'From: No-Reply <no-reply@' . $_SERVER['HTTP_HOST'] . '>',
'content-type: text/html'
);
wp_mail('[email protected]', 'Mail subject text here', $message, $headers);
}
@karamansky
karamansky / Очистка номера телефона от символов
Last active December 26, 2022 13:19
PHP: Очистка номера телефона от символов
<a href="tel:+'. preg_replace("/[^0-9]/", "", $phone) .'">'. $phone .'</a>
@karamansky
karamansky / Accordion FAQ
Last active December 26, 2022 13:18
HTML:JS: Accordion FAQ
<div class="faq__items">
<div class="faq__item">
<input type="checkbox" id="chck1" name="chck">
<label class="faq__item-label" for="chck1">
Who do I contact if something needs to be fixed or replaced in my unit?
</label>
<div class="faq__item-content">
Please check with the concierge if your apartment is still available and we’ll be glad to arrange your extended stay. If not, you might need to move to a new unit. For bookings via Airbnb: you’ll have to request a new reservation before your original check-out time. For security reasons, your smart lock code might change due to the extended stay. If this is the case, we’ll send you the new code via email.
</div>
</div>
var request = new XMLHttpRequest();
request.open('GET', api_url + '/images?matchingId=' + apartment_id, false);
request.send(null);
$(window).scroll(function(){
var wt = $(window).scrollTop();
var wh = $(window).height();
var et = $('элемент').offset().top;
var eh = $('элемент').outerHeight();
var dh = $(document).height();
if (wt + wh >= et || wh + wt == dh || eh + et < wh){
console.log('Элемент показан');
}
});
User-agent: * # общие правила для роботов всех поисковых систем
Disallow: /cgi-bin # служебная папка для хранения серверных скриптов
Disallow: /? # все параметры запроса на главной
Disallow: /wp- # все файлы WP: /wp-json/, /wp-includes, /wp-content/plugins
Disallow: /wp/ # если есть подкаталог /wp/, где установлена CMS (если нет,
# правило можно удалить)
Disallow: *?s= # поиск по сайту
Disallow: *&s= # поиск по сайту
Disallow: /search/ # поиск по сайту
Disallow: /author/ # архив автора
public static function anaCreateImgFromText( $string, $image_random_name = 'tmp_name' ){
// set charset
mb_internal_encoding("UTF-8");
$content = "";
$font = get_stylesheet_directory() . "/assets/fonts/Lato/regular.ttf";
// text width
$width = 540;
//font size
$size = 16;
// reference the Dompdf namespace
use Dompdf\Dompdf;
use Dompdf\Options;
$text_data = [
'<p><b>Analyst:</b> <span>SEAN WIELAND</span> (PIPER SANDLER)</p>',
'<p><b>The Stock:</b> <span>CHNG</span> (Change Healthcare Inc)</p>',
'<p><b>Price Target Change:</b> $494->$549 = $55 (11.13%)</p>',
'<p><b>Average Time For PT To Be Met:</b> 251</p>',
'<p><b>Potential Upside Change:</b> $109.6->$164.6; 198%->133%</p>',