Skip to content

Instantly share code, notes, and snippets.

View karki-dennis's full-sized avatar
🎯
Focusing

Dennish Karki karki-dennis

🎯
Focusing
View GitHub Profile
@karki-dennis
karki-dennis / sendmail.php
Last active May 2, 2022 06:15
Send mail using ajax WP
<?php
add_action( 'wp_ajax_send_email', 'callback_send_email' );
add_action( 'wp_ajax_nopriv_send_email', 'callback_send_email' );
function callback_send_email() {
$forms = 'forms@xyz.com';
$name = $_REQUEST['name'];
$email_add = $_REQUEST['email_add'];
$business = $_REQUEST['business'];
$business_address = $_REQUEST['business_address'];
# Goes in your .git/config file
[alias]
# Temporarily stop tracking a file in git.
# usage: git unwatch path/to/file
unwatch = update-index --assume-unchanged
# Resume tracking a file in git.
# usage: git watch path/to/file
watch = update-index --no-assume-unchanged
# Goes in your .git/config file
[alias]
# Temporarily stop tracking a file in git.
# usage: git unwatch path/to/file
unwatch = update-index --assume-unchanged
# Resume tracking a file in git.
# usage: git watch path/to/file
watch = update-index --no-assume-unchanged
@karki-dennis
karki-dennis / Sticky Nav Js
Created April 21, 2017 03:35
Sticky nav js
if ($(window).width() > 768) {
var mn = $("#masthead");
mns = "nav--sticky";
hdr = $('header').outerHeight();
$(window).scroll(function () {
if ($(this).scrollTop() > hdr) {
mn.addClass(mns);
} else {
mn.removeClass(mns);
@karki-dennis
karki-dennis / ng-gallery-custom.php
Created November 25, 2016 09:57
ng gallery custom loop to acess gallery
@karki-dennis
karki-dennis / Wordpress featured image alt.php
Last active November 18, 2016 11:04
Print featured image alt
@karki-dennis
karki-dennis / visible.js
Created September 21, 2016 06:45
detect the div is visivle or not
$.fn.inView = function () {
if (!this.length) return false;
var rect = this.get(0).getBoundingClientRect();
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
rect.right <= (window.innerWidth || document.documentElement.clientWidth)
);
@karki-dennis
karki-dennis / scroll direction.js
Last active May 24, 2018 03:50
scroll top and down detect
var lastScrollTop = 0;
$(window).scroll(function (event) {
var st = $(this).scrollTop();
if (st > lastScrollTop) {
// downscroll code
} else {
// upscroll code
@karki-dennis
karki-dennis / foundation drill down menu
Created May 26, 2016 10:28
Replace Back text by li text in wordpress with foundation menu
$(document).foundation();
$(".menu-item-has-children").each(function () {
var str = $(' > a', this).text();
$(this).children('.sub-menu').children('.js-drilldown-back').children('a').html(str);
});