Skip to content

Instantly share code, notes, and snippets.

View rakeshkumar125's full-sized avatar

Rakesh Kumar rakeshkumar125

View GitHub Profile
wp_enqueue_style(
'fancyboxstyles',
WP_PLUGIN_URL.'/chat/custom.css',
false,
all);
function my_init() {
if (!is_admin()) {
wp_deregister_script('jquery');
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js', false, '1.3.2', true);
function add_query_vars($aVars) {
$aVars[] = "user_id";
return $aVars;
}
// hook add_query_vars function into query_vars
add_filter('query_vars', 'add_query_vars');
function add_rewrite_rules($aRules) {
<?php
/*
Template Name: User Template
*/
get_header();
echo $user_id = ($wp_query->query_vars['user_id'] ? $wp_query->query_vars['user_id'] : '0');
get_footer();
?>
@rakeshkumar125
rakeshkumar125 / php-Validation-class-structure
Last active July 31, 2016 14:03
this class include all rule that can be used for the form validation.
<?php
// Class Defination starts here.
//include('connection.php');
// above class include for connect datbase connection
class validator{
var $array_to_validate = "";
var $email = "";
@rakeshkumar125
rakeshkumar125 / php-Validation-class-structure-usage
Created July 31, 2016 14:11
PHP code for usage validation class
$config = array();
$config['array_to_validate'] = $_POST or array_need_to_validate;
$config['email'] = "email,forgot_email";
$config['required'] = "date_birth,phone,mobile";
$config['numeric'] = "mobile";
$config['positive_numeric'] = "positive_number";
$config['positive_integer'] = "positive_integer";
$config['url'] = "url";
$config['alpha'] = "name";
$config['alphanumeric'] = "user_password";
<?php
if (PHP_SAPI === 'cli') {
require("cronLockHelperClass.php");
if (($pid = cronHelper::lock()) !== FALSE) {
// here need to apply the logic
cronHelper::unlock();
} else {
@rakeshkumar125
rakeshkumar125 / gist:5d33bb1b769f863f61616e651eb7ef58
Created April 1, 2017 19:26
function for populate values REF, INV, PO
function addPackageLineItem($input)
{
$packageLineItem = array
(
'SequenceNumber' => 1,
'GroupPackageCount' => 1,
'Weight' => array
(
'Value' => $input['Weight'],
'Units' => 'LB'
@rakeshkumar125
rakeshkumar125 / BuddyPress add new tab
Created July 30, 2017 12:57
BuddyPress add new tab
/**
Plugin Name: BuddyPress add new tab
Description: Test case for a bug. When using the Admin subnav, select "Test" and "Test 2" will disappear
Version: 0.6
Author: Rakesh Kumar
**/
function bptt_init() {
class Groups_Test_Tab extends BP_Group_Extension {
@rakeshkumar125
rakeshkumar125 / angular 6 navigation
Created August 22, 2018 02:00
Navigation code angular 6 routing
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">WebSiteName</a>
</div>
<ul class="nav navbar-nav navbar-right">
<li routerLinkActive="active"><a routerLink='home'>Home</a></li>
<li routerLinkActive="active"><a routerLink='about'>About</a></li>
<li routerLinkActive="active"><a routerLink='contact'>Contact</a></li>
</ul>
import { Injectable, EventEmitter, Output } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { Response } from "@angular/http";
import { Observable } from 'rxjs';
import 'rxjs/add/operator/map';
@Injectable()
export class AppService{
isLoggedin:boolean;
@Output() getLoggedInName = new EventEmitter();