Skip to content

Instantly share code, notes, and snippets.

View khoipro's full-sized avatar
💭
#devops #wordpress #vuejs #docker

Nguyễn Minh Khôi khoipro

💭
#devops #wordpress #vuejs #docker
View GitHub Profile
@khoipro
khoipro / header.php
Created April 13, 2016 09:23
Default stylesheet in WordPress header.
<style type="text/css">
img.wp-smiley,
img.emoji {
display: inline !important;
border: none !important;
box-shadow: none !important;
height: 1em !important;
width: 1em !important;
margin: 0 .07em !important;
vertical-align: -0.1em !important;
@khoipro
khoipro / functions.php
Created April 13, 2016 09:31
Adding thumbnail support for posts in WordPress
if (function_exists('add_theme_support')) {
add_theme_support('post-thumbnails');
}
set_post_thumbnail_size( 70, 70);
add_image_size( 'single-post-thumbnail', 600, 350 );
@khoipro
khoipro / .htaccess
Created May 12, 2016 05:08
Font CSS Blocked - Cross-Origin Resource Sharing policy
<IfModule mod_headers.c>
<FilesMatch "\.(eot|font.css|otf|ttc|ttf|woff)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>
<IfModule mod_mime.c>
# Web fonts
AddType application/font-woff woff
AddType application/vnd.ms-fontobject eot
@khoipro
khoipro / .editorconfig
Created May 19, 2016 04:08
Editorconfig to prevent using CRLF in Atom code editor
# EditorConfig is awesome: http://EditorConfig.org
# Remember to install a plugin https://github.com/sindresorhus/atom-editorconfig
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
@khoipro
khoipro / mixin_ratio_background_image.scss
Created June 21, 2016 08:27
Mixin to create a background image with fixed ratio (like square) in all devices
@mixin image-aspect($ratio) {
position: relative;
height: auto;
display: block;
&:before {
display: block;
content: "";
width: 100%;
padding-top: percentage(1/$ratio);
var $ = require( 'jquery' ),
throttle = require( 'modules/throttle' );
module.exports = function( el ) {
var $el = $( el ),
$window = $( window ),
$bar = $( '#bottom-bar' ),
$close = $bar.find('.close-icon'),
$footer = $( '.footer' );
(function($,sr){
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
@khoipro
khoipro / gist:663ba6b90216079f28c4b1bd3dd73e28
Created March 28, 2017 08:30 — forked from croxton/gist:4073583
Install xdebug 2.2.0 for AMPPS on OSX
Grab the 'PHP Remote Debugging Client' (the pre-complied xdebug binary for OSX) from here:
http://code.activestate.com/komodo/remotedebugging/
Unzip it, find the folder that corresponds to the version of PHP you want to install it for and copy the xdebug.so file from there into your php extensions folder in the relevant PHP version directory. E.g. for PHP 5.4:
/Applications/AMPSS/php-5.4/lib/extensions/ext/
Now open PHP.ini in a text editor:
/Applications/AMPSS/php-5.4/etc/php.ini
@khoipro
khoipro / functions.php
Created August 14, 2017 08:19
Gallery Shortcode WordPress - Hacking Output
<?php
/*
* Change WordPress default gallery output
*/
add_filter('post_gallery', 'ct_post_gallery', 10, 2);
function ct_post_gallery($output, $attr) {
global $post;
if (isset($attr['orderby'])) {
$attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
@khoipro
khoipro / favicon.html
Created November 18, 2017 04:46
Favicon example generator
<link rel="shortcut icon" sizes="16x16 24x24 32x32 48x48 64x64" href="https://codetot.net/favicon.ico">
<link rel="apple-touch-icon" sizes="57x57" href="/wp-content/themes/thirty/img/icons/favicon-57.png">
<link rel="apple-touch-icon-precomposed" sizes="57x57" href="/wp-content/themes/thirty/img/icons/favicon-57.png">
<link rel="apple-touch-icon" sizes="72x72" href="/wp-content/themes/thirty/img/icons/favicon-72.png">
<link rel="apple-touch-icon" sizes="114x114" href="/wp-content/themes/thirty/img/icons/favicon-114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/wp-content/themes/thirty/img/icons/favicon-120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/wp-content/themes/thirty/img/icons/favicon-144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/wp-content/themes/thirty/img/icons/favicon-152.png">
<meta name="application-name" content="codetot.net">
<meta name="msapplication-TileImage" content="/wp-content/themes/thirty/img/icons/favicon-144.png">