Skip to content

Instantly share code, notes, and snippets.

View arvindsvt's full-sized avatar

Arvind Shrivastwa arvindsvt

  • Ahmedabad
View GitHub Profile
@arvindsvt
arvindsvt / wpsearchreplace.php
Created June 8, 2016 17:15 — forked from djaney/wpsearchreplace.php
Used when transferring WP sites. Replace database entries.
<?php
// Safe Search and Replace on Database with Serialized Data v1.0.1
// This script is to solve the problem of doing database search and replace
// when developers have only gone and used the non-relational concept of
// serializing PHP arrays into single database columns. It will search for all
// matching data on the database and change it, even if it's within a serialized
// PHP array.
@arvindsvt
arvindsvt / wp-modifydb.php
Created June 8, 2016 17:16 — forked from jcanfield/wp-modifydb.php
Serialized PHP Search and Replace
<?php
/**
*
* Safe Search and Replace on Database with Serialized Data v2.0.1
*
* This script is to solve the problem of doing database search and replace when
* developers have only gone and used the non-relational concept of serializing
* PHP arrays into single database columns. It will search for all matching
* data on the database and change it, even if it's within a serialized PHP
* array.
@arvindsvt
arvindsvt / safesearchreplace.php
Created June 8, 2016 17:18 — forked from marke123/safesearchreplace.php
safe search and replace
<?php
// Safe Search and Replace on Database with Serialized Data v2.0.0
// This script is to solve the problem of doing database search and replace
// when developers have only gone and used the non-relational concept of
// serializing PHP arrays into single database columns. It will search for all
// matching data on the database and change it, even if it's within a serialized
// PHP array.
@arvindsvt
arvindsvt / find-replace-sql-wp.sql
Created June 8, 2016 17:18 — forked from celsofabri/find-replace-sql-wp.sql
SQL Query para fazer um simples localizar e substituir / SQL Query to do a simple find and replace
UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_links SET link_url = replace(link_url, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_links SET link_image = replace(link_image, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_usermeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');
/*UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl' OR option_name = 'widget_text' OR option_name = 'dashboard_widget_options';*/
UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com');
@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):

@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 / 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 / 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 / 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 / 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;
};