Skip to content

Instantly share code, notes, and snippets.

View arvindsvt's full-sized avatar

Arvind Shrivastwa arvindsvt

  • Ahmedabad
View GitHub Profile
https://www.youtube.com/watch?v=Q5QkgK3xcDo
<?php
/**
* @package WPCamp 2019
* @version 1.0
*/
/*
Plugin Name: rewrite api custom permalink - BUILD
Description: Creates custom post type and custom permalink
Author: Sergio
@arvindsvt
arvindsvt / functions.php
Created December 7, 2019 12:33 — forked from vivek-kumar-poddar/functions.php
This is an updated version of social media buttons. This code snippet will help you to add social media buttons to your website without even using any plugin. Furthermore it's javascript free. Enjoy fast speed and the same usability. For more details visit the official post: https://wpvkp.com/add-social-media-sharing-buttons-to-wordpress-without…
// Function to handle the thumbnail request
function get_the_post_thumbnail_src($img)
{
return (preg_match('~\bsrc="([^"]++)"~', $img, $matches)) ? $matches[1] : '';
}
function wpvkp_social_buttons($content) {
global $post;
if(is_singular() || is_home()){
// Get current page URL
@arvindsvt
arvindsvt / functions.php
Created December 7, 2019 12:33 — forked from vivek-kumar-poddar/functions.php
This is an updated version of social media buttons. This code snippet will help you to add social media buttons to your website without even using any plugin. Furthermore it's javascript free. Enjoy fast speed and the same usability. For more details visit the official post: https://wpvkp.com/add-social-media-sharing-buttons-to-wordpress-without…
// Function to handle the thumbnail request
function get_the_post_thumbnail_src($img)
{
return (preg_match('~\bsrc="([^"]++)"~', $img, $matches)) ? $matches[1] : '';
}
function wpvkp_social_buttons($content) {
global $post;
if(is_singular() || is_home()){
// Get current page URL
@arvindsvt
arvindsvt / EasyRouter.php
Last active October 30, 2019 15:09
EasyRouter - A simple PHP powered, REST capable Router and Facade for easier route calls, and an example static and Class implementation
https://github.com/azeemhassni/simplest-php-router
https://github.com/arvindsvt/PHP-Custom-MVC
<?php namespace EasyRouter {
/**
* A simple, Object Oriented, yet effective REST capable PHP micro router. Can
* easily be used as a `stand-alone` Router or implemented with composers PSR4
* or your own PSR4 autoloader. See link reference below for a simple, and yet
* effective PSR4 Autoloader I had made.
*
@arvindsvt
arvindsvt / DoublyLinkedList.c
Created June 22, 2019 03:07 — forked from mycodeschool/DoublyLinkedList.c
Doubly Linked List implementation in C
/* Doubly Linked List implementation */
#include<stdio.h>
#include<stdlib.h>
struct Node {
int data;
struct Node* next;
struct Node* prev;
};
@arvindsvt
arvindsvt / bootstrap-walker-menu.php
Created March 17, 2018 16:25 — forked from braginteractive/bootstrap-walker-menu.php
WordPress Walker Menu for Bootstrap
<?php
// Custom Walker Class for Bootstrap Menu
add_action( 'after_setup_theme', 'bootstrap_setup' );
if ( ! function_exists( 'bootstrap_setup' ) ):
function bootstrap_setup(){
class Bootstrap_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl( &$output, $depth = 0, $args = array() ) {
$indent = str_repeat( "\t", $depth );
$output .= "\n$indent<ul class=\"dropdown-menu\">\n";
}
@arvindsvt
arvindsvt / recursion.php
Last active April 22, 2019 06:43 — forked from recck/recursion.php
Week 4 - Day 8 - Recursive Functions
https://www.geeksforgeeks.org/php-sum-digits-number/
Armstrong number in PHP
<?php
$num=407;
$total=0;
$x=$num;
while($x!=0)
{
$rem=$x%10;
$total=$total+$rem*$rem*$rem;
@arvindsvt
arvindsvt / php-pdo-mysql-crud.md
Last active February 4, 2018 05:52 — forked from odan/php-pdo-mysql-crud.md
Basic CRUD operations with PDO and MySQL

Basic CRUD operations with PDO

CRUD = Create, Read, Update, Delete

Open a database connection

$host = '127.0.0.1';
$dbname = 'test';
$username = 'root';
@arvindsvt
arvindsvt / array_flatten.php
Last active February 5, 2018 15:12 — forked from SeanCannon/array_flatten.php
PHP array_flatten() function. Convert a multi-dimensional array into a single-dimensional array.
<?php function array_flatten($array, $prefix = '') {
$result = array();
foreach($array as $key=>$value) {
if(is_array($value)) {
$result = $result + array_flatten($value, $prefix . $key . '.');
}
else {
$result[$prefix.$key] = $value;
}
}
@arvindsvt
arvindsvt / List.md
Created June 19, 2016 09:38 — forked from msurguy/List.md
List of open source projects made with Laravel

Other people's projects:

My projects (tutorials are on my blog at http://maxoffsky.com):