Skip to content

Instantly share code, notes, and snippets.

View PatelUtkarsh's full-sized avatar
🧘

Utkarsh Patel PatelUtkarsh

🧘
View GitHub Profile
@PatelUtkarsh
PatelUtkarsh / gitlab-release.sh
Last active November 11, 2015 09:33
Get production zip from git lab for wordpress premium plugin
#!/bin/bash
# Edit your variable here here is url for my project git.rtcamp.com/rtbiz/rtbiz-helpdesk where rtbiz is team and rtbiz-helpdesk is project
# This will give you final zip file which you may use as release version. it will remove unnecessary development files from zip.
gitLab="http://git.rtcamp.com"
team="rtbiz"
project="rtbiz-helpdesk"
read -p "User name or email: " login
echo -n Password:
read -s password
@PatelUtkarsh
PatelUtkarsh / get.php
Created November 12, 2015 14:28
PHP abstract function to create select query using array
<?php
/** $where['date'] = array(
'compare' => 'BETWEEN',
'value' => array(
$start,
$end
)
);
$where['27/11/2015'] = array(
@PatelUtkarsh
PatelUtkarsh / greythr.sh
Last active August 16, 2023 08:21
Attendence Login or logout to greythr
#!/bin/bash
#set login & password or this will ask everytime
#login=
#password=
#comment this if you set login password on top!
read -p "User name or email: " login
echo -n Password:
@PatelUtkarsh
PatelUtkarsh / migration-makeitfast.php
Last active January 12, 2016 11:27
Migration to Wordpress step 0
<?php
/**
* call this function before executing your wp-cli(maybe in constructor of wp-cli command file) or php script.
*/
function makeitfast() {
//no cache
wp_suspend_cache_addition( true );
// suspend cache invalidation
wp_suspend_cache_invalidation( true );
//don't save queries
@PatelUtkarsh
PatelUtkarsh / fast_post_meta.php
Last active May 6, 2016 12:59
Add all post meta using single Insert SQL for migration.
<?php
/**
* $arr all meta in associative array.
* $post_id where to insert post.
**/
function add_post_meta_all( $arr, $post_id ) {
global $wpdb;
$inserts = array();
foreach ( $arr as $key => $val ) {
if ( is_array( $val ) ) {
@PatelUtkarsh
PatelUtkarsh / search_columns.sql
Created March 15, 2016 12:30
Search mysql database columns
SELECT DISTINCT TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%awesome%'
AND TABLE_SCHEMA='YourDatabase';
@PatelUtkarsh
PatelUtkarsh / phpcs.md
Created April 29, 2016 12:54
PHPCS for Linux

Installation

Install PEAR

sudo apt-get install php-pear

Install PHP_CodeSniffer

@PatelUtkarsh
PatelUtkarsh / ee-vip-go-local.sh
Created May 11, 2016 05:54
Setup vip-go in local environment for site which are already created with easyengine.
#!bin/bash
#
# NOTE:This file takes param as site name for
#
# This script currenty only works with easyengine.
#
# What this does essentially is clones mu-plugin repo of vip-mu-plugins-public
# and write nginx rule to handle static files via php.
#
# WARNING: This does not match extact vip go environment like php version and stuff

Keybase proof

I hereby claim:

  • I am patelutkarsh on github.
  • I am utkarshpatel (https://keybase.io/utkarshpatel) on keybase.
  • I have a public key ASBj2OJgHP6USNvVqXiGww94HtJgp8r0cPz2lnnl5PBn_Qo

To claim this, I am signing this object:

@PatelUtkarsh
PatelUtkarsh / execute-wp-cron.sh
Last active July 10, 2016 08:25
Running wp-cron with wp-cli
#!/bin/bash
WP_PATH="/path/to/wp"
# Check for WP-CLI
if ! hash wp 2>/dev/null; then
echo "WP-CLI is not available"
exit
fi