Skip to content

Instantly share code, notes, and snippets.

Cooking something hot in oven for WordPress

Ram Ratan Maurya mauryaratan

Cooking something hot in oven for WordPress
Block or report user

Report or block mauryaratan

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
mauryaratan / WP3.5 Media Uploader
Created Dec 14, 2012
WordPress 3.5 media uploader in easier steps. If using other than edit post screen, don't forget to use wp_enqueue_media(); in your functions.php
View WP3.5 Media Uploader
var _custom_media = true,
_orig_send_attachment =;
$('.stag-metabox-table .button').click(function(e) {
var send_attachment_bkp =;
var button = $(this);
var id = button.attr('id').replace('_button', '');
_custom_media = true; = function(props, attachment){
if ( _custom_media ) {
mauryaratan / htaccess-tweaks
Created May 7, 2012
htaccess Gzip Compression and expires to speed up page load time
View htaccess-tweaks
<IfModule mod_deflate.c>
#The following line is enough for .js and .css
AddOutputFilter DEFLATE js css
AddOutputFilterByType DEFLATE text/plain text/xml application/xhtml+xml text/css application/xml application/rss+xml application/atom_xml application/x-javascript application/x-httpd-php application/x-httpd-fastphp text/html
#The following lines are to avoid bugs with some browsers
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
mauryaratan / scrollable-container.js
Last active Jun 16, 2018
Adds a top/bottom shadow for scrollable area depending on current scroll position.
View scrollable-container.js
const scrollable = document.querySelectorAll( '.scrollable' );
scrollable.forEach( function( el ) {
if ( el.offsetHeight < el.scrollHeight ) {
el.classList.add( 'bottom-shadow' );
el.addEventListener( 'scroll', function( e ) {
const scrollHeight =;
const scrollPosition = scrollHeight +;
mauryaratan / shortcuts.js
Created May 22, 2018
Shortkeys (Custom Keyboard Shortcuts) custom settings
View shortcuts.js
mauryaratan / woocommerce-search-filter.php
Created Apr 2, 2014
Make your WordPress site use WooCommerce product archives search pages by default.
View woocommerce-search-filter.php
function crux_search_filter( $query ) {
if ( $query->is_search ) {
$query->set( 'post_type', 'product' );
$query->is_archive = true;
$query->is_post_type_archive = true;
return $query;
mauryaratan / .eslint.json
Created Jan 31, 2018
ESLint configuration.
View .eslint.json
"root": true,
"env": {
"browser": true,
"es6": true
"plugins": [
mauryaratan / insertPost.js
Last active Jan 5, 2018
Insert a post manually to put correct data back in its place.
View insertPost.js
// Embassy Suites Amarillo,"550 Buchanan Street, Amarillo, TX 79101","Amarillo, TX",Hilton,Open,226,,,35.207672,-101.8324899
async function fetchAsync(string) {
const response = await fetch(ajaxurl, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
credentials: 'same-origin',
View RGBa-Mixin with fallback for sass.scss
* RGBa-Mixin with fallback (
@mixin transparent-backgound($color: #000, $value:0.5)
$start: "rgb(";
$end: ")";
background: #{$start}red($color), green($color), blue($color)#{$end};
background: rgba($color, $value);
mauryaratan / stagtools.txt
Last active Aug 14, 2017
StagTools WordPress Plugin's list of all available shortcodes, just in case you want to use theme manually instead of shortcode builder.
View stagtools.txt
[stag_alert style="white"]Your Alert![/stag_alert]
Styles: white, grey, red, yellow, green, blue
mauryaratan / chrome-snippets.json
Created Jul 28, 2017
Google Chrome Snippets, can be imported/exported from here since Chrome doesn't offers any methods to sync it.
View chrome-snippets.json
"snippets": [
"name": "dataurl.js",
"content": "// dataurl.js\n//\n// Print out data URLs for all images / canvases on the page.\n\n((() => {\n\n\"Data URLs\");\n\n []\"img\"), i => {\n const c = document.createElement(\"canvas\");\n const ctx = c.getContext(\"2d\");\n c.width = i.width;\n c.height = i.height;\n\n try {\n ctx.drawImage(i, 0, 0);\n console.log(i, c.toDataURL());\n }\n catch(e) {\n console.log(i, \"No Permission - try opening this image in a new tab and running the snippet again?\", i.src);\n }\n });\n\n []\"canvas\"), c => {\n try {\n console.log(c, c.toDataURL());\n }\n catch(e) {\n console.log(c, \"No Permission\");\n }\n });\n\n console.groupEnd(\"Data URLs\");\n\n}))();"
"name": "jqueryify.js",
"content": "// jquerify.js\n// https://github.c
You can’t perform that action at this time.