Skip to content

Instantly share code, notes, and snippets.

Ivan Dorić ivandoric

Block or report user

Report or block ivandoric

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ivandoric / gist:11211773
Last active Aug 29, 2015
shell: Change all directories to 755 and all files to 644
View gist:11211773
find . -type d -print0 | xargs -0 chmod 0775 # For directories
find . -type f -print0 | xargs -0 chmod 0664 # For files
ivandoric / gist:11212113
Created Apr 23, 2014
shell: Change owner group for all files
View gist:11212113
chown -R web37:client9 *
ivandoric / gist:11212154
Created Apr 23, 2014
wordpress: Dynamical wordpress pages menu with included ancestor
View gist:11212154
$children = get_pages('child_of='.$post->ID);
$ancestors = get_post_ancestors($post->ID);
//Check if the page has children or ancestors if yes, output pages menu.
if(!empty($children) or !empty($ancestors)){
if( is_page() ) {
global $post;
$parents = get_post_ancestors( $post->ID );
ivandoric / gist:11212191
Created Apr 23, 2014
wordpress: WPML Custom Language switcher
View gist:11212191
/*Just add this anywhere in yopur template where you want language switcher to appear.
This switcher just shows the flags. But you can make it work anyway you like */
<ul class="lang-switcher">
$languages = icl_get_languages('skip_missing=N&orderby=KEY&order=DIR&link_empty_to=str');
foreach($languages as $language){
$flag = $language['country_flag_url'];
ivandoric / gist:11212211
Created Apr 23, 2014
magento: Echo out Name of the user
View gist:11212211
$session = Mage::getSingleton('customer/session');
if($session->isLoggedIn()) {
$customer = $session->getCustomer();
echo $customer->getName();
echo $customer->getFirstname();
ivandoric / gist:11212247
Created Apr 23, 2014
magento: Remove category filter
View gist:11212247
<?php //Add this to your local.xml - removes category filter from sideabar. ?>
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml">
<action method="unsetChild"><child>category_filter</child></action>
ivandoric / gist:11214990
Created Apr 23, 2014
wordpress: Select subcategory in wordpress
View gist:11214990
add_action( 'admin_print_footer_scripts', 'selektirajPodkategorije' );
function selektirajPodkategorije(){ ?>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#categorychecklist").find("input:checkbox").click(function() {
var koji = jQuery(this).parent().parent().parent().attr("id");
if(koji == "categorychecklist") {
ivandoric / gist:11215015
Created Apr 23, 2014
wordpress: move site - update URLs
View gist:11215015
/*add this to functions.php file in theme */
/* After the site is up and running remove those two lines */
ivandoric / gist:11215045
Created Apr 23, 2014
shell: SCP cheat sheet
View gist:11215045
Copy the file "foobar.txt" from a remote host to the local host
$ scp /some/local/directory
Copy the file "foobar.txt" from the local host to a remote host
$ scp foobar.txt
Copy the directory "foo" from the local host to a remote host's directory "bar"
$ scp -r foo
Copy the file "foobar.txt" from remote host "" to remote host ""
ivandoric / gist:11215077
Created Apr 23, 2014
jQuery: Smooth scroll
View gist:11215077
jQuery('a[href^="#"]').bind('click.smoothscroll',function (e) {
var target = this.hash;
$target = jQuery(target);
jQuery('html, body').stop().animate({
'scrollTop': $target.offset().top
}, 500, 'swing', function () {
window.location.hash = target;
You can’t perform that action at this time.