Skip to content

Instantly share code, notes, and snippets.

View andrii-marushchak's full-sized avatar
🏠
Working from home

Andrii Marushchak andrii-marushchak

🏠
Working from home
  • Ukraine, Ivano-Frankivsk
View GitHub Profile
# Custom 404 page
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ error.php [L]
# Force http to https
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
const links = document.querySelectorAll('a[href^="#"]:not(.modal-toggle)')
links.forEach((nodeElement) => {
nodeElement.addEventListener('click', function (e) {
e.preventDefault()
const href = this.getAttribute('href')
if (href === '#') {
return false;
define('BROWSER_AVIF', strpos($_SERVER['HTTP_ACCEPT'], 'image/avif') !== false);
define('BROWSER_WEBP', strpos($_SERVER['HTTP_ACCEPT'], 'image/webp') !== false);
@andrii-marushchak
andrii-marushchak / timezones.php
Created September 19, 2020 23:06 — forked from kulbakin/timezones.php
Array of timezones where keys are PHP timezone names and values are human friendly timezone titles.
<?php
/**
* List of timezones
*/
return array(
'Pacific/Midway' => '(UTC-11:00) Midway',
'Pacific/Niue' => '(UTC-11:00) Niue',
'Pacific/Pago_Pago' => '(UTC-11:00) Pago Pago',
'America/Adak' => '(UTC-10:00) Adak',
'Pacific/Honolulu' => '(UTC-10:00) Honolulu',
@andrii-marushchak
andrii-marushchak / share.php
Last active December 9, 2020 20:02
Share Buttons
<!-- Basic Share Links -->
<!-- Twitter (url, text, @mention) -->
<a href="https://twitter.com/share?url=<URL>&text=<TEXT>via=<USERNAME>">
Twitter
</a>
<a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-show-count="false">Tweet</a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>