Skip to content

Instantly share code, notes, and snippets.

@rugor
rugor / gist:95c6e08eea54adb962460b50a7db36e9
Created May 1, 2018 17:17
PHP: WordPress remove width and height from image tags for responsive images
/**
* Removes width and height attributes from image tags
*
* @param string $html
*
* @return string
*/
function remove_image_size_attributes( $html ) {
return preg_replace( '/(width|height)="\d*"/', '', $html );
}
@rugor
rugor / gist:68c91959bb9e087d0405aa93bf14e3a2
Created February 14, 2018 01:28
VueJS: Infinite Loading Masonry Component #rugor
// "dependencies": {
// "vue": "2.4.4",
// "vue-images-loaded": "^1.1.2",
// "vue-infinite-loading": "^2.2.3",
// "vueisotope": "^3.1.1"
// }
<template>
<div id="root_layout">
@rugor
rugor / gist:16f3b78e5f2bbac892c9f1aabeb39f56
Created January 30, 2018 00:52
JavasScript: JSON default prettier.rc file #rugor
{
"printWidth": 100,
"parser": "flow",
"semi": false,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true
}
@rugor
rugor / cloudSettings
Last active February 16, 2018 17:48
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-02-16T17:48:28.194Z","extensionVersion":"v2.8.7"}
@rugor
rugor / cloudSettings
Last active September 25, 2017 05:57
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-09-25T05:57:00.565Z","extensionVersion":"v2.8.2"}
@rugor
rugor / gist:778e3768f0908e297c4e43cc391e976a
Created February 20, 2017 18:41
PHP: WordPress wp-config.php disable WP auto-update #rugor
define( 'WP_AUTO_UPDATE_CORE', false );
@rugor
rugor / gist:6131cd28cb51f0c70238dacb9e1a494b
Created January 31, 2017 00:25
JavaScript: Vue.js v-for with index and last item class #rugor
<div v-for="(item, index) in items" v-bind:class="{last : index === (items.length-1)}">
<p>Foo</p>
</div>
@rugor
rugor / gist:d045520561b555b93650267e8e6f395b
Created January 20, 2017 19:34
JavaScript: jQuery Modernizr image SVG to PNG swap #rugor
if (!Modernizr.svg) {
$('img[src$=".svg"]').each(function()
{
$(this).attr('src', $(this).attr('src').replace('.svg', '.png'));
});
}
@rugor
rugor / gist:341b5e8df01da6d7db6e6833ef593812
Created October 19, 2016 01:19
.htaccess: drop the .html from static files for clean urls
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
@rugor
rugor / gist:e0dfeb4a3919cab2843077642cc6abfb
Created October 18, 2016 21:48
.htaccess: Quick add svg type and WordPress rewrite rules
AddType image/svg+xml svg
AddType image/svg+xml svgz
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d