Skip to content

Instantly share code, notes, and snippets.

Utkarsh Patel PatelUtkarsh

Block or report user

Report or block PatelUtkarsh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
PatelUtkarsh / index.js
Created Feb 19, 2020
Refresh WordPress media library images - useful when editors are uploading image via 3rd party tool using REST API - Example: Mediawires so editor do not need to reload page to get new images on existing article.
View index.js
jQuery( document ).ready( function () {
// Refresh media library each time on click of add media.
if ( ) { 'open', function () {
if ( !== null ) {
// this forces a refresh of the content. true );
} );
PatelUtkarsh / index.php
Last active Aug 3, 2019
Attachment custom fields
View index.php
namespace Utkarsh\Attachment\Meta;
const META_NAME = 'media_credit';
* Bootstrap.
function bootstrap() {
PatelUtkarsh / dnsmasq.conf
Last active Apr 8, 2020
stubby cloudflare ipv4 and ipv6
View dnsmasq.conf
# Put any other line here like laravel valet using .test domain.
PatelUtkarsh / snippet.js
Last active Feb 26, 2019
Get all hostname from homepage <a>
View snippet.js
var anchors = document.querySelectorAll('a');
var hosts = new Set();
anchors.forEach((anch) => {
View class-demo.php
* The Demo class.
* @package xyz
namespace UtkarshPatel\Demo
PatelUtkarsh / easyengine-cask.rb
Last active Nov 23, 2018
Easyengine Brew core and cask formula
View easyengine-cask.rb
cask 'easyengine' do
version '4.0.0'
homepage ''
url ''
sha256 '5d7f7ec95911883240717458024f0e7c69309f7bd3646353a0594e1b0900eaa6'
name 'Easyengine'
depends_on formula: 'php'
depends_on cask: 'docker'
container type: :naked
PatelUtkarsh /
Last active Jan 3, 2019
Get notification when internet is up, This uses pushbullet api.
function notifynet(){
echo "Pres CTRL+C to stop..."
while :
sleep 5
if [ $(ping -q -c 1 -W 1 >/dev/null) ]; then
echo -n "1"
if [ $isdown -eq 1 ]; then
PatelUtkarsh / fix-symlink-url.php
Last active Oct 29, 2018
Fix url when wp-content and mu-plugins are added as symlink.
View fix-symlink-url.php
PatelUtkarsh / class-migrate.php
Last active Jun 28, 2018
Custom table to WordPress schema migration base class proof of concept. NOT TESTED.
View class-migrate.php
* Migration Abstract class.
* Should inherit this class and all documented class variable must overwrite in child class for this to work.
* @package rtCamp
namespace rtCamp\TableMigrate;
PatelUtkarsh /
Last active Dec 24, 2018
Git cheat sheet shallow clone

All i know about shallow clone


  • For all readonly purpose this works great.
  • For big repo like linux project, mozilla firefox or WordPress like project it's really boring to wait for git to fetch all refs since we rearely needs all refs (if you know you're not gonna need).
  • You can contribute even after shallow clone but it works only in somecases mentioned below.

Fetch only one commit

git clone -b master git_url --depth 1
You can’t perform that action at this time.