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 / hot load jquery.js
Last active June 19, 2018 12:42
javascript - dinamicaly load jquery from frontend - browser console
var p='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js';
var d=document;
var s=d.createElement('script');s.setAttribute("src",p);
d.getElementsByTagName("head")[0].appendChild(s);
@mkdizajn
mkdizajn / index.html
Last active February 23, 2018 17:11
glagoljica
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<link rel="shortcut icon" type="image/x-icon" href="https://static.codepen.io/assets/favicon/favicon-8ea04875e70c4b0bb41da869e81236e54394d63638a1ef12fa558a4a835f1164.ico" />
<link rel="mask-icon" type="" href="https://static.codepen.io/assets/favicon/logo-pin-f2d2b6d2c61838f7e76325261b7195c27224080bc099486ddd6dccb469b8e8e6.svg" color="#111" />
@mkdizajn
mkdizajn / index.html
Created February 15, 2018 07:24
Medvednica - Sljeme - Webcam - Vidikovac Zagreb stream
<div>
<button url="https://cdn-002.whatsupcams.com/hls/hr_sljeme1.m3u8" class="btn btn-info" >Video 1</button>
<button url="https://cdn-002.whatsupcams.com/hls/hr_sljeme2.m3u8" class="btn btn-info" >Video 2</button>
<a class="btn btn-primary">Radio Sljeme</a>
</div>
<video id="video" controls></video>
<audio id="aud"></audio>
<div id="list">
<a v-on:click="pullData('posts')">Show posts </a> |
<a v-on:click="pullData('comments')">Show comments </a>
<ul>
<div v-if="type == 'posts' ">
<li v-for="item in items">
<div class="title"> {{ item.title }} </div>
<div class="add1"> {{ item.body }} </div>
</li>
</div>
Tricks to add encrypted private SSH key to .travis.yml file
To encrypt the private SSH key into the "-secure: xxxxx....." lines to place in the .travis.yml file, generate a deploy key then run: (to see what the encrypted data looks like, see an example here: https://github.com/veewee-community/veewee-push/blob/486102e6f508214b04414074c921475e5943f682/.travis.yml#L21
base64 --wrap=0 ~/.ssh/id_rsa > ~/.ssh/id_rsa_base64
ENCRYPTION_FILTER="echo \$(echo \"-\")\$(travis encrypt veewee-community/veewee-push \"\$FILE='\`cat $FILE\`'\" | grep secure:)"
split --bytes=100 --numeric-suffixes --suffix-length=2 --filter="$ENCRYPTION_FILTER" ~/.ssh/id_rsa_base64 id_rsa_
@mkdizajn
mkdizajn / jQuery-hook-and-bind-to-addClass-or-attr-method.js
Last active September 8, 2017 11:53
How easily to hook into native jQuery event,, I have built example to alter attr method, but it can easily be 'addClass', 'removeClass' etc..
(function($) {
// save Original attr method!
var orgAttr = $.fn.attr;
// Change attr | addClass | similar method to be able to hook to JQ event
$.fn.attr = function(){
var result = orgAttr.apply( this, arguments ); // Execute the original method.
$(this).trigger('customTriggerName'); // trigger custom event on element
return result; // return the original result
}
// HOOK @ ATTR binded event
@mkdizajn
mkdizajn / js.js
Created June 22, 2017 16:40
total fullscreen mobile menu link patch
(function($){
$('.mobile-menu-toggle').on('click', function(){
if( !window.bindOnceAfterMobileMenuFinished){
$( '.full-screen-overlay-nav.black li a span' ).on('click', function(event) {
var hash = $(this).attr('data-ls_linkto');
setTimeout(function() {
window.wpex.scrollTo(hash);
}, 600, hash);
$('.full-screen-overlay-nav-close').click();
});
@mkdizajn
mkdizajn / How to Allow Administrators to Edit Users in a WordPress Network
Created April 2, 2013 10:16
How to Allow Administrators to Edit Users in a WordPress Network
<?php
/* wordpress multisite how to allow administrators to edit users! */
function mc_admin_users_caps( $caps, $cap, $user_id, $args ){
foreach( $caps as $key => $capability ){
if( $capability != 'do_not_allow' )
continue;
@mkdizajn
mkdizajn / magento aw blog recent posts widget to display short content.php
Last active April 24, 2017 10:56
magento aw blog recent posts widget to display short content
<?php
/**
* aheadWorks Co.
*
* NOTICE OF LICENSE
*
* This source file is subject to the EULA
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://ecommerce.aheadworks.com/AW-LICENSE.txt