Skip to content

Instantly share code, notes, and snippets.

@dimobelov
dimobelov / bluditsnipet.php
Last active August 4, 2018 12:58
Page Category
<?php if ($page->category()):?>
<div class="entry-terms-wrapper entry-categories-wrapper clear">
<span class="entry-terms category">
<a href="<?php echo DOMAIN_CATEGORIES.$page->categoryKey() ?>" rel="tag">
<?php echo $page->category() ?>
</a>
</span>
</div>
<?php endif?>
@dimobelov
dimobelov / specchars.php
Created August 20, 2018 18:36
Bludit special chars dictionary
private static $specialChars = array(
// Latin
'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'AE', 'Ç'=>'C',
'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I',
'Ð'=>'D', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ő'=>'O',
'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ű'=>'U', 'Ý'=>'Y', 'Þ'=>'TH',
'ß'=>'ss',
'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a', 'å'=>'a', 'æ'=>'ae', 'ç'=>'c',
'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i',
'ð'=>'d', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ő'=>'o',
@dimobelov
dimobelov / web.config
Last active September 7, 2018 07:13
IIS Bludit configuration
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<!--add/replace these lines in <system.webServer> section ...-->
<directoryBrowse enabled="false" />
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="index.htm" />
@dimobelov
dimobelov / customscroll.css
Created September 23, 2018 10:54
Custom scrollbars
.customScrollBar::-webkit-scrollbar-button:horizontal:increment {
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2RpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowRUZGQzk4NEE1Q0FFMDExOUI2OUQ1NEZFODhFQjY5MCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowQzU1NDExQUNFQTExMUUwODVCRDlGMjgxNTUwOTY0MSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDowQzU1NDExOUNFQTExMUUwODVCRD
<!-- Pagination -->
<?php if (Paginator::numberOfPages()>1): ?>
<div class="container">
<div class="row">
<div class="col-md-12 text-center">
<nav class="pagination" role="navigation">
<div class="row">
<div class="col-4 text-left">
<?php if (Paginator::showPrev()):?>
<a class="newer-posts btn" href="<?php echo Paginator::previousPageUrl() ?>">
@dimobelov
dimobelov / .htaccess
Created November 28, 2018 06:28 — forked from seoagentur-hamburg/.htaccess
UPDATE 2018: Perfect .htaccess file for highspeed and security. You can use it for every WordPress-Website without problems. Highspeed and Security - testet on hundreds of Websites. If you are using a WordPress Multisite, change the last part of this file.
########################################################################
# OPTIMAL .htaccess FILE FOR SPEED AND SECURITY @Version 2018
########################################################################
# ----------------------------------------------------------------------
# Rewrite from HTTP to HTTPS - if you want to use it, comment it out
# ----------------------------------------------------------------------
@dimobelov
dimobelov / wc_paypal.php
Created December 6, 2018 14:31
Allow BGN for WooCommerce and PayPal
// allow BGN for WooCommerce and PayPal
add_filter( 'woocommerce_paypal_supported_currencies', 'add_bgn_paypal_valid_currency' );
function add_bgn_paypal_valid_currency( $currencies ) {
array_push ( $currencies , 'BGN' );
return $currencies;
}
// Convert BGN to EUR for PayPal payments
add_filter('woocommerce_paypal_args', 'convert_bgn_to_eur');
(function (history, trackingId, options) {
const getParameterByName = (paramName) => {
var searchString = window.location.search.substring(1),
i, val, params = searchString.split("&");
for (i=0;i<params.length;i++) {
val = params[i].split("=");
if (val[0] == paramName) {
return val[1] || undefined;
}
}
@dimobelov
dimobelov / gitlab-upload.txt
Last active February 1, 2019 07:20
GitLab API - Upload File
I created a function to also import issue attachements. I still need to add it to this lib. For anyone looking to do the work by yourself:
See: https://docs.gitlab.com/ee/api/projects.html#upload-a-file
private async Task<string> GitLabFileUploadAsync(string url, string token, string projectId, byte[] file, string fileName)
{
using (var httpClient = new HttpClient())
{
var form = new MultipartFormDataContent
{
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):e.quicklink=n()}(this,function(){var e={};function n(e){return new Promise(function(n,t){var r=new XMLHttpRequest;r.open("GET",e,r.withCredentials=!0),r.onload=function(){200===r.status?n():t()},r.send()})}var t,r,i=(t="prefetch",((r=document.createElement("link")).relList||{}).supports&&r.relList.supports(t)?function(e){return new Promise(function(n,t){var r=document.createElement("link");r.rel="prefetch",r.href=e,r.onload=n,r.onerror=t,document.head.appendChild(r)})}:n);function o(t,r,o){if(!(e[t]||(o=navigator.connection)&&((o.effectiveType||"").includes("2g")||o.saveData)))return(r?function(e){return null==self.fetch?n(e):fetch(e,{credentials:"include"})}:i)(t).then(function(){e[t]=!0})}var u=u||function(e){var n=Date.now();return setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-n))}})},1)},c=new Set,f=new IntersectionObserve