Skip to content

Instantly share code, notes, and snippets.

View sbrajesh's full-sized avatar

Brajesh Singh sbrajesh

View GitHub Profile
@sbrajesh
sbrajesh / copy-png-files.php
Created August 17, 2016 10:16
Copy png files from the directory recursively to the destination directory
<?php
/** Copy PNG files from the Source Directory( and its child directories) to destination as specified
*
* I use it to move all the png files from the extracted subtle patterns directories to another directory
*
* @param string $path the directory which contains our subdirectories
* @param string $destination_dir the absolute path to directory where files will be moved
*/
function copy_png_files( $path, $destination_dir ) {
@johnbillion
johnbillion / wp_mail.md
Last active January 27, 2024 14:06
WordPress Emails

WordPress Emails

This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.

This documentation has moved here: https://github.com/johnbillion/wp_mail

@fer-ri
fer-ri / laravel.js
Last active October 18, 2021 12:45 — forked from soufianeEL/laravel.js
You use Laravel 5 and you want to send a DELETE request without creating a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. To use, import script, and create a link with the `data-method="DELETE"` and `data-token="{{csrf_token()}}"` attributes.
/*
Taken from: https://gist.github.com/soufianeEL/3f8483f0f3dc9e3ec5d9
Modified by Ferri Sutanto
- use promise for verifyConfirm
Examples :
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}">
- Or, request confirmation in the process -
<a href="posts/2" data-method="delete" data-token="{{csrf_token()}}" data-confirm="Are you sure?">
@paulirish
paulirish / what-forces-layout.md
Last active April 19, 2024 14:42
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@sivaprabug
sivaprabug / tblcitylist.sql
Created April 8, 2013 12:49
MySQL database of Indian Cities and states,latitude and longitude..
-- phpMyAdmin SQL Dump
-- version 3.5.2.2
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Apr 08, 2013 at 02:48 PM
-- Server version: 5.5.27
-- PHP Version: 5.4.7
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
@boonebgorges
boonebgorges / gist:5057165
Created February 28, 2013 14:36
Hide WordPress plugins from the plugins.php admin screen in a flexible way
<?php
/**
* Prevent specific plugins from being activated (or, in some cases, deactivated).
*
* Plugins that are to be deprecated should be added to the $disabled_plugins array.
*
* Plugins that should be un-deactivatable should be added to the $undeactivatable_plugins array
*/
function cac_hide_plugins( $plugins ) {
@JimWestergren
JimWestergren / index-with-redis.php
Last active February 11, 2023 18:28
Redis as a Frontend Cache for WordPress
<?php
/*
Author: Jim Westergren & Jeedo Aquino
File: index-with-redis.php
Updated: 2012-10-25
This is a redis caching system for wordpress.
see more here: www.jimwestergren.com/wordpress-with-redis-as-a-frontend-cache/
@necolas
necolas / snippet.js
Created June 14, 2011 20:36
Optimised async loading of cross-domain scripts
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
*/
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],