Skip to content

Instantly share code, notes, and snippets.

View mkdizajn's full-sized avatar
🐢
slow & thorough > faster & mistakable

Kresimir Pendic mkdizajn

🐢
slow & thorough > faster & mistakable
View GitHub Profile
@mkdizajn
mkdizajn / function.php
Last active May 6, 2020 15:59
Wordpress Bootstrap 3 responsive images
<?php
//----------------------------------------------------------/
// responsive images [ 1) add img-responsive class 2) remove dimensions ]
//----------------------------------------------------------/
function bootstrap_responsive_images( $html ){
$classes = 'img-responsive'; // separated by spaces, e.g. 'img image-link'
// check if there are already classes assigned to the anchor
if ( preg_match('/<img.*? class="/', $html) ) {
@mkdizajn
mkdizajn / sql.sql
Created February 22, 2020 15:23
fix wordpress corupt tables -> this sql script reinit keys and indexes on all default WP tables
Script by https://wpindexfixer.tools.managedwphosting.nl
These are the queries for WP version 5.3.2
You need to replace wp_ with your site prefix — could be wp_ or something
-- Starting with wp_users
DELETE FROM wp_users WHERE ID = 0;
ALTER TABLE wp_users ADD PRIMARY KEY (ID);
ALTER TABLE wp_users ADD KEY user_login_key (user_login);
@mkdizajn
mkdizajn / index.html
Created December 10, 2019 23:06
MotionPathHelper demo
<!-- "Rocket Man" by Chris Gannon https://cdpn.io/EjVyXN -->
<svg id="motionPath" viewBox="-20 0 557 190">
<path id="path" d="M514.848,240.268 C514.848,240.268 462.662,309.218 412.151,283.486 360.531,257.176 424.152,258.407 369.053,201.105 311.913,141.681 165.959,196.156 231.489,257.236 266.054,289.453 337.87,332.206 321.33799,225.90001 315.616,189.108 133.021,268.325 123.252,316.289 110.777,377.48 227.33,329.843 281.915,305.464 335.673,281.454 173.976,283.356 86.665,300.815 6.436,316.844 20.851,252.546 20.851,252.546 "/>
<path id="path2" d="M6.931,91.47 C6.931,91.47 144.087,127.04 105.017,130.397 47.303,135.349 93.65999,62.66001 168.74799,36.56901 231.32099,14.82701 180.40899,65.70901 245.79799,65.03901 312.60199,64.35401 333.10199,116.64001 307.50799,134.80901 277.14599,156.36201 141.60999,64.21301 131.83799,112.16901 119.36699,173.36601 216.199,184.68 268.085,214.373 326.136,247.594 392.043,78.874 409.064,75.233 424.067,72.023 505.879,63.687 505.879,63.687 " />
<image class="astronaut" xlink:
@mkdizajn
mkdizajn / js.js
Created October 2, 2019 10:22
masonry add to existing grid some element (that was hidden) cloned
(function($) {
"use strict";
$(document).ready(function (){
// push custom widgetized calendar widget (hidden inside footer page)
// to masonry layout grid
var elem = $('.calmasonry').clone()
// clone the classes for layout of the box
elem.addClass('isotope-entry col span_1_of_4').removeClass('hidden')
$('#blog-entries').masonry().append( elem ).masonry( 'appended', elem ).masonry()
@mkdizajn
mkdizajn / Dinamic_IP_address_logger.sh
Last active June 19, 2019 14:05
My bash IP logger (saves all ip addresses in file in my choosen directory
#! /bin/sh
# let it sleep for half a minute..
sleep 30
# get my current mobile IP address!
IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
# move to root dir
cd /home/krex/bin/IPS_TELE2/
# append current IP if not there already
grep -qxF $IP file || echo $IP >> file
@mkdizajn
mkdizajn / regex-search.js
Created May 17, 2019 23:36
JavaScript multiline search for string in string with delimiters or markers. Uses regex
var start = "some starting term";
var end = "some ending term";
var reg = new RegExp("(?:"+ start +")([\\s\\S]*)(?:"+ end +")", "igm");
var j = res.match( reg );
// example with search markers
var txt = `Lorem Ipsum is simply dummy
text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard
dummy text ever since the 1500s, when an unknown printer
@mkdizajn
mkdizajn / gist:8630775
Created January 26, 2014 10:00
magento switch websites snippet
<!-- BEGIN website switcher -->
<select id="website-changer" onChange="document.location=this.options[selectedIndex].value">
<?php
$websites = Mage::getModel('core/website')->getCollection();
foreach($websites as $website)
{
$default_store = $website->getDefaultStore();
$url_obj = new Mage_Core_Model_Url();
$default_store_path = $url_obj->getBaseUrl(array('_store'=> $default_store->getCode()));
?>
@mkdizajn
mkdizajn / style.css
Last active August 28, 2018 16:26
zebra stripes on select2 select component
/*zebra for select2*/
ul.select2-results li:nth-child(even){
background-color: #ddd;
color: black;
}
ul.select2-results li:nth-child(even):hover{
background-color: #333;
color: white;
}
@mkdizajn
mkdizajn / wordpress plugin rewrite media path
Created December 11, 2012 11:09
wordpress plugin rewrite media path
<?php
/*
Plugin Name: Rewrite Wordpress upload path
Plugin URI: http://mkdizajn.com
Description: Rewrites your image paths.
Version: 2.4
Author: kreso
Author URI: http://mkdizajn.com/
*/
@mkdizajn
mkdizajn / url-emoticons-in-SERP
Created July 10, 2018 11:19
Google search results emoticons in urls -- SERP emoticon urls -- firefox support color but Google Chrome doesn't
https://www.google.hr/search?tbs=sbi:AMhZZiuvJh9qdvPGSzBLKa9IO6t9V7S7dIN-vFwmyFDKIfON_1ACNEchxJA-56WbyXVhQpZZ3IIdWLu7jvKoC1N-Tzx0sFE5xyqSa-05GZ-k1Q6IgeDEikSURitBjoaKh8SAVf-JgsNj_1bpC14Ecrl6hnbiS-ajo5ZsL2YQG2Plm7VdBq7pzh9I0S1rYYqcHmv7fesqR290J5AZreHD67sCqPWi8XucQWHYlkl9GWvQvni9zILnWQ7tSynK8F08GCMvDgIlpld-RCk6IddixocavYEuPy0YF1gaiZMaGQYA6_1pzAYlpG2DTUY0BXLpIz9u9zb5QhVkYzNrokvoORmiFAWkmybTM-TGQ&hl=en-HR