Instantly share code, notes, and snippets.

View class-demo.php
<?php
/**
* The Demo class.
*
* @package xyz
*/
namespace UtkarshPatel\Demo
/**
View easyengine-cask.rb
cask 'easyengine' do
version '4.0.0'
homepage 'https://easyengine.io/'
url 'https://github.com/EasyEngine/easyengine/releases/download/v4.0.0/easyengine.phar'
sha256 '5d7f7ec95911883240717458024f0e7c69309f7bd3646353a0594e1b0900eaa6'
name 'Easyengine'
depends_on formula: 'php'
depends_on cask: 'docker'
container type: :naked
View notify.sh
function notifynet(){
isdown=0
echo "Pres CTRL+C to stop..."
while :
do
sleep 5
if [ $(ping -q -c 1 -W 1 8.8.4.4 >/dev/null) ]; then
echo -n "1"
if [ $isdown -eq 1 ]; then
isdown=0
View fix-symlink-url.php
View class-migrate.php
<?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;
View readme.md

All i know about shallow clone

Usecases:

  • 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
View wp-config.php
<?php
/**
* Add this block in wp-config.php file.
*
* Move any other `WP_HOME` or `WP_SITEURL` in else condition if present.
*/
if ( isset( $_SERVER['HTTP_X_ORIGINAL_HOST'] ) ) {
$is_ssl = isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] );
$actual_link = ( $is_ssl ? "https" : "http" ) . "://{$_SERVER[ 'HTTP_X_ORIGINAL_HOST' ]}";
define( 'WP_HOME', $actual_link );
View index.php
<?php
/**
* Send pushbullet msg on website hit.
* Author: Utkarsh Patel (github.com/patelutkarsh)
*
* Usage: push.example.com?msg=webpush&title=Awesome&secret=SecretForAuthReplaceME
*/
// If unauthorized user kick him.
if ( ! isset( $_GET['secret'] ) || 'SecretForAuthReplaceME' !== $_GET['secret'] ) {
View backup-sites.sh
#!/bin/bash
# Generate your Dropbox token: https://www.dropbox.com/developers/apps
DROPBOX_TOKEN={dropbox access token here}
# Directory that holds your WordPress sites' root folders
PREFIX=/var/www
# If you have multiple folders with WordPress sites, add/remove them from this array
directories=( "foo.com" "bar.com" )
View execute-wp-cron.sh
#!/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