Skip to content

Instantly share code, notes, and snippets.

View prayas-sapkota's full-sized avatar

Prayas Sapkota prayas-sapkota

View GitHub Profile
@prayas-sapkota
prayas-sapkota / custom-wp-nav-menu-classes.php
Created December 8, 2023 17:15 — forked from davidwebca/custom-wp-nav-menu-classes.php
Allow adding custom classes to WordPress menu ul, li, a and at different depths. Perfect for TailwindCSS and AlpineJS usage.
<?php
/**
* WordPress filters to allow custom arguments to wp_nav_menu to,
* in turn, allow custom classes to every element of a menu.
*
* You can apply a class only to certain depth of your menu as well.
*
* The filters use the depth argument given by WordPress
* which is an index, thus starts with level 0 (zero).
*

If .DS_Store was never added to your git repository, simply add it to your .gitignore file.

If you don't have one, create a file called

.gitignore

In your the root directory of your app and simply write

@prayas-sapkota
prayas-sapkota / yoast_seo_opengraph_change_image_size.php
Created December 1, 2022 13:25 — forked from amboutwe/yoast_seo_opengraph_change_image_size.php
Code snippet to change or remove OpenGraph output in Yoast SEO. There are multiple snippets in this code.
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change size for Yoast SEO OpenGraph image for all content
* Credit: Yoast Development team
* Last Tested: May 19 2020 using Yoast SEO 14.1 on WordPress 5.4.1
* Accepts WordPress reserved image size names: 'thumb', 'thumbnail', 'medium', 'large', 'post-thumbnail'
* Accepts custom image size names: https://developer.wordpress.org/reference/functions/add_image_size/
*/
@prayas-sapkota
prayas-sapkota / bitbucket-pipelines.yml
Created March 9, 2018 14:27 — forked from mcnamee/bitbucket-pipelines.yml
Bitbucket Pipelines - Deploy via FTP to shared hosting
image: samueldebruyn/debian-git
pipelines:
custom: # Pipelines that are triggered manually
init: # -- First time init
- step:
script:
- apt-get update
- apt-get -qq install git-ftp
- git ftp init --user $FTP_USERNAME --passwd $FTP_PASSWORD ftp://$FTP_HOST
@prayas-sapkota
prayas-sapkota / meta-tags.md
Created May 11, 2017 08:04 — forked from whitingx/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@prayas-sapkota
prayas-sapkota / gist:26289b405b2003c6378ad6248d4674b8
Created March 13, 2017 11:00 — forked from prime31/gist:5675017
Simple PHP script showing how to send an Android push notification. Be sure to replace the API_ACCESS_KEY with a proper one from the Google API's Console page. To use the script, just call scriptName.php?id=THE_DEVICE_REGISTRATION_ID
<?php
// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' );
$registrationIds = array( $_GET['id'] );
// prep the bundle
$msg = array
@prayas-sapkota
prayas-sapkota / serial-number.sql
Created September 7, 2016 11:50
Auto increment serial number in sql query.
SELECT @a:=@a+1 serial_number, student_name, student_class FROM TBL_STUDENT, (SELECT @a:= 0) AS a;
@prayas-sapkota
prayas-sapkota / number-to-words-nepali-format.php
Created September 7, 2016 06:17
Convert numeric value to word in Nepali currency format.
// $f = new NumberFormatter("en", NumberFormatter::SPELLOUT);
// echo $f->format(1432123.45);
$number = 1257.37;
$no = round($number);
$point = round($number - $no, 2) * 100;
$hundred = null;
$digits_1 = strlen($no);
$i = 0;
$str = array();
@prayas-sapkota
prayas-sapkota / number-to-words-nepali-format.js
Created September 7, 2016 06:16
Convert numeric value to word in Nepali currency format.
var number, no, point, hundred, digits_1, i, str, words, digits, divider, plural, counter, result, points;
number = 1257.37;
number = number.toString().split('.');
no = number[0];
point = number[1];
hundred = '';
digits_1 = no.length;
i = 0;
str = new Array();
words = {'0':'', '1':'One', '2':'Two', '3':'Three', '4':'Four', '5':'Five', '6':'Six', '7':'Seven', '8':'Eight', '9':'Nine', '10':'Ten', '11':'Eleven', '12':'Twelve', '13':'Thirteen', '14':'Fourteen', '15':'Fifteen', '16':'Sixteen', '17':'Seventeen', '18':'Eighteen', '19':'Nineteen', '20':'Twenty', '30':'Thirty', '40':'Forty', '50':'Fifty', '60':'Sixty', '70':'Seventy', '80':'Eighty', '90':'Ninety'};
@prayas-sapkota
prayas-sapkota / scripts.js
Last active April 17, 2016 02:49
ACF add row
function daysInMonth(year, month) {
month++;
return new Date(year, month, 0).getDate();
}
function CompareDates( d1, d2 ) {
if ( d1 < d2 ) return -1; // d1 is in the past of d2
if ( d1 > d2 ) return 1; // d1 is in the future of d2
return 0;
}
jQuery(document).ready(function($) {