Skip to content

Instantly share code, notes, and snippets.

View gagimilicevic's full-sized avatar

Milicevic Dragan gagimilicevic

View GitHub Profile
@gagimilicevic
gagimilicevic / is_subpage.php
Created October 29, 2019 10:33 — forked from jhebb/is_subpage.php
WordPress is_subpage() function to check if a page against it's immediate parent or all it's parents
/**
* Is SubPage?
*
* Checks if the current page is a sub-page and returns true or false.
*
* @param $page mixed optional ( post_name or ID ) to check against.
* @param $single boolean optional - default true to check against all parents, false to check against immediate parent.
* @return boolean
*/
@gagimilicevic
gagimilicevic / is-private-mode.js
Created October 24, 2019 09:51 — forked from jherax/is-private-mode.js
Detect if the browser is running in Private mode (Promise based)
// uncomment if you are transpiling with Babel + Webpack
// const { window, document } = global;
/**
* Lightweight script to detect whether the browser is running in Private mode.
* @returns {Promise}
*
* Live demo:
* @see http://live.datatables.net/piduzelo/1
*
@gagimilicevic
gagimilicevic / custom.js
Created October 23, 2019 15:56
Defer YouTube iFrames - You could always try using Youtube's javascript API and https://developers.google.com/youtube/iframe_api_reference
<script>
// 2. This code loads the IFrame Player API code asynchronously.
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
// 3. This function creates an <iframe> (and YouTube player)
// after the API code downloads.
npm install node-sass --unsafe-perms
@gagimilicevic
gagimilicevic / custom.php
Created September 11, 2019 18:56
Return value from add_action function
// define action with param for result transport
function some_action($someParam, $transport) {
// do stuff
if($someParam > 10) {
$transport->return = true;
} else {
$transport->return = 5;
}
}
@gagimilicevic
gagimilicevic / index.html
Created March 14, 2019 22:07 — forked from laurenclark/index.html
Pure CSS Social Media Icons
<div class="footer-social-icons">
<h4 class="_14">Follow us on</h4>
<ul class="social-icons">
<li><a href="" class="social-icon"> <i class="fa fa-facebook"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-twitter"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-rss"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-youtube"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-linkedin"></i></a></li>
<li><a href="" class="social-icon"> <i class="fa fa-google-plus"></i></a></li>
</ul>
@gagimilicevic
gagimilicevic / Uninstall.md
Created February 12, 2019 22:24 — forked from pokisin/Uninstall.md
Uninstall git, ubuntu

Uninstall git

To remove just git package itself from Ubuntu 14.04 execute on terminal:

$ sudo apt-get remove git

Uninstall git and it's dependent packages

To remove the git package and any other dependant package which are no longer needed from Ubuntu Trusty.

$ sudo apt-get remove --auto-remove git

Disable HTML Form Input Autocomplete and Autofill

  1. Add autocomplete="off" onto <form> element;
  2. Add hidden <input> with autocomplete="false" as a first children element of the form.
<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
    ...
@gagimilicevic
gagimilicevic / class-wp-numeric-pagination.php
Created November 23, 2018 14:51 — forked from pixeline/class-wp-numeric-pagination.php
Wordpress Numeric Pagination Class that enables you to set the classes of each LI and A html tag.
<?php
/**
* Numeric Pagination Class
* @author Alexandre Plennevaux https://pixeline.be
*
* This class returns a list of LI > A. It is up to you to set the wrapping NAV > UL around your function call.
*
* @usage (setting specific classes)
*
* // Sets the css classes you want to be used for the output
@gagimilicevic
gagimilicevic / facebook_page_latest_post_no_php_sdk.php
Created November 22, 2018 22:52 — forked from biojazzard/facebook_page_latest_post_no_php_sdk.php
Get Latest Post From a Facebook Page without PHP SDK (Graph Version v2.5)
<?php
/*
1.- Create an App.
2.- Go to: https://developers.facebook.com/tools/explorer/
+ Select your new created app on the right top.
+ Select "Get App Token"