Skip to content

Instantly share code, notes, and snippets.

<?php
// add hook
add_filter( 'wp_nav_menu_objects', 'my_wp_nav_menu_objects_sub_menu', 10, 2 );
// filter_hook function to react on sub_menu flag
function my_wp_nav_menu_objects_sub_menu( $sorted_menu_items, $args ) {
if ( isset( $args->sub_menu ) ) {
$root_id = 0;
@abrarfahad
abrarfahad / CityController.js
Last active September 5, 2016 09:51
set A New Property In A List Of Object. If you wants to view a country name in a city list you can use this gist.
// Code goes here
'use strict';
// Define the `MyApp` module
var app = angular.module('MyApp', []);
app.controller("CityController", function($scope,$filter) {
$scope.Init = function(){
// ==UserScript==
// @name Set Busbd Home
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match *.busbd.com.bd*
// @grant none
// ==/UserScript==
@abrarfahad
abrarfahad / compare_tow_tableColumnAndCompareValue.js
Last active May 16, 2019 07:23
this program will select the 3rd column cells of table and go through each cell of that column and compare to the adjacent next cell value. if that condition matches the background color of next cell will be green otherwise print the ratio.
var tdlist = jQuery("tr td:nth-child(3)");
tdlist.each(function() {
//console.log($( this ).text().trim().replace(',','')/2.5);
//console.log($( this ).next().text());
if($( this ).next().text()==$( this ).text().trim().replace(',','')){
$( this ).next().css("background-color", "green");
}else{
console.log($( this ).next().text()/$( this ).text().trim().replace(',',''));
}
});
using System;
namespace AIUB_SESOURCE_MANAGEMENT
{
abstract class Equipment
{
string Light;
string fan;
string ac;
string chair;
@abrarfahad
abrarfahad / MimeTypeVerification.js
Created March 27, 2023 04:43 — forked from GiantZOC/MimeTypeVerification.js
Check the header to see the file type
//https://stackoverflow.com/questions/18299806/how-to-check-file-mime-type-with-javascript-before-upload/29672957#29672957
// Return the first few bytes of the file as a hex string
function getBLOBFileHeader(url, blob, callback) {
var fileReader = new FileReader();
fileReader.onloadend = function (e) {
var arr = (new Uint8Array(e.target.result)).subarray(0, 4);
var header = "";
for (var i = 0; i < arr.length; i++) {
header += pad(arr[i].toString(16), 2);