Thursday, 21 September 2017

Parse server backup from heroku


/**********************************************************************************
//Installation parse server
install nodejs above 4.3
install mongodb


Heroku install on local
//install heroku
gem install heroku
//login to terminal enter email id and password
heroku login


//clone app on local machine
heroku git:clone -a your_app_name

//run parse server
cd app_direc >> run npm install commond >> npm start

besic git commond


//for initilize git
git init
git pull
git push
git commit -m "enter message"
git add .
git checkout filename
git status //for check status
git branch // check current branch
git clone git url // get clone from server
git checkout master //change branch
//check remote directory
git remote -v
//if you have not cloned an existing repository and want to connect your
git remote add origin <server>
//add brnach merge
 git merge <branch>
//diffence file
git diff file name filename
//replace local chenges
git checkout
 git fetch origin
If you instead want to drop all your local changes and commits, fetch the latest history from the server and point your local master branch at it like this
git fetch origin
git reset --hard origin/master

Tuesday, 22 August 2017

menu selected on scroll and click

 $(document).on("scroll", onScroll);
    $('.mobile-nav').click(function () {
        $(this).toggleClass('nav-open');
        $(this).next().slideToggle();
        $('.header').toggleClass('fixed');
    });

    $(".header-menu li a").click(function (evn) {
        evn.preventDefault();
        if (!evn.detail || evn.detail == 1) {
            $(document).off("scroll");

            var curobj = $(this).attr('href');
            $(this).parent().siblings().removeClass('active');
            $(this).parent().addClass('active');
            var topOffsetVal = $(curobj).offset().top - $('#header').outerHeight();
            $('html,body').animate({scrollTop: topOffsetVal}, 1000, function () {
                $(document).on("scroll");
                $(document).on("scroll", onScroll);
            });
        }
    });

    $(".footer-nav li a").click(function (evn) {
        evn.preventDefault();

        var curobj = $(this).attr('href');
        var curobj1 = $(this).attr('data-id');
        $(".header-menu li").removeClass('active');
        $("#" + curobj1).addClass('active');
        var topOffsetVal = $(curobj).offset().top - $('#header').outerHeight();
        $('html,body').animate({scrollTop: topOffsetVal}, 1000, function () {
            $(document).on("scroll");
            $(document).on("scroll", onScroll);
        });
        ;
    });

    $(".down-bottom a").on('click', function (event) {
        event.preventDefault();
        var curobj = $(this).attr('href');
        var curobj1 = $(this).attr('data-id');
        $(".header-menu li").removeClass('active');
        $("#" + curobj1).addClass('active');
        var topOffsetVal = $(curobj).offset().top - $('#header').outerHeight();
        $('html,body').animate({scrollTop: topOffsetVal}, 1000, function () {
            $(document).on("scroll");
            $(document).on("scroll", onScroll);
        });
        ;
    });




    function onScroll(event) {
        var scrollPos = $(document).scrollTop();
        $('.header-menu a').each(function () {
            var currLink = $(this);
            var refElement = $(currLink.attr("href"));
            if (refElement.position().top - 88 <= scrollPos) {
                $('.header-menu li').removeClass("active");
                $('.header-menu li.active a').attr("href")
                currLink.parent().addClass("active");
            }
            else {
                currLink.parent().removeClass("active");
            }


        });
    }





    $(window).scroll(function () {
        if ($(this).scrollTop() > 100) {
            $('.scrollToTop').fadeIn();
        } else {
            $('.scrollToTop').fadeOut();
        }
    });
//Click event to scroll to top
    $('.scrollToTop').click(function (evn) {
        $('html, body').animate({scrollTop: 0}, 1000);
    });



    $(".panel-heading").click(function () {
        $(this).next().slideToggle();
    });
})

Sunday, 20 August 2017

jquery add error placement

 errorPlacement: function (error, element) {
            if (element.attr("name") == "hear_about[]") {
                error.insertAfter(".checkboxerror3");
            }
}

jquery validation cumtom


$(document).ready(function () {

    /*
     *  Check initial space
     */
    $.validator.addMethod("noInitiallSpace", function (value, element) {
        return this.optional(element) || $.trim(value) != '';
    }, ("No space please and don't leave it empty"));



    /********check space starting and end ***********/
    $.validator.addMethod("noSpace",
            function (value, element) {
                return value.indexOf(" ") < 0 && value != "";
            }, ("No space please and don't leave it empty"));

    function getWordCount(wordString) {
        var words = wordString.split(" ");
        words = words.filter(function (words) {
            return words.length > 0
        }).length;
        return words;
    }

//add the custom validation method
    $.validator.addMethod("wordCount",
            function (value, element, params) {
                var count = getWordCount(value);
                if (count < 500) {
                    return true;
                }
            },
            ("Please enter no more than  {0} characters.")
            );


    /*********add validation for latter only *****/
    $.validator.addMethod("letter",
            function (value, element) {
                return this.optional(element) || /^[a-z-.,()'\"\s]+$/i.test(value);
            }, ('Only letters allowed!'));



    /***********check password 8 char 1 numeric 1 char*********/

    $.validator.addMethod("pwdcheck",
            function (value, element) {
                return /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]).{8,50}$/i.test(value);

            }, ('Password should be alphanumeric with minimum 8 characters.'));


    /***********check password 8 char 1 numeric 1 char*********/

    $.validator.addMethod("custom_number", function (value, element) {
        return this.optional(element) || value === "NA" ||
                value.match(/^[0-9]+$/);
    }, ("Please enter a valid number"));

    $.validator.addMethod("extension", function (value, element, param) {
        var ext = value.split('.').pop().toLowerCase();
        if ($.inArray(ext, param) == -1 && ext != '') {
            return false;
        }
        return true;
    }, ("Upload only pdf"));



})

Wednesday, 26 July 2017

jquery validation message overide

Add this code in a separate file/script included after the validation plugin to override the messages, edit at will :)
jQuery.extend(jQuery.validator.messages, {
    required: "This field is required.",
    remote: "Please fix this field.",
    email: "Please enter a valid email address.",
    url: "Please enter a valid URL.",
    date: "Please enter a valid date.",
    dateISO: "Please enter a valid date (ISO).",
    number: "Please enter a valid number.",
    digits: "Please enter only digits.",
    creditcard: "Please enter a valid credit card number.",
    equalTo: "Please enter the same value again.",
    accept: "Please enter a value with a valid extension.",
    maxlength: jQuery.validator.format("Please enter no more than {0} characters."),
    minlength: jQuery.validator.format("Please enter at least {0} characters."),
    rangelength: jQuery.validator.format("Please enter a value between {0} and {1} characters long."),
    range: jQuery.validator.format("Please enter a value between {0} and {1}."),
    max: jQuery.validator.format("Please enter a value less than or equal to {0}."),
    min: jQuery.validator.format("Please enter a value greater than or equal to {0}.")
});

Tuesday, 25 July 2017

remove update from wordpress

/*&
     *@Disable auto update plugn and themes and wordpress version
     */
   
    add_action('after_setup_theme','remove_core_updates');
    function remove_core_updates()
    {
    if(! current_user_can('update_core')){return;}
    add_action('init', create_function('$a',"remove_action( 'init', 'wp_version_check' );"),2);
    add_filter('pre_option_update_core','__return_null');
    add_filter('pre_site_transient_update_core','__return_null');
    }

    remove_action('load-update-core.php','wp_update_plugins');
    add_filter('pre_site_transient_update_plugins','__return_null');