Skip to content

Instantly share code, notes, and snippets.

View ajaegers's full-sized avatar

Arnaud JAEGERS ajaegers

View GitHub Profile
/**
* How to vertical align (top | middle | bottom) your html elements
* @usage:
* <div class="valign-box">
* <div class="valign-top"></div>
* <div class="valign-middle"></div>
* <div class="valign-bottom"></div>
* </div>
*/
.valign-box {
@ajaegers
ajaegers / .htaccess
Last active August 29, 2015 14:13
SEO: Properly remove old urls/domain from Google index
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !/robots.txt [NC]
Rewriterule ^(.*)$ http://yournewsite.com/$1 [L,R=301]
</IfModule>
@ajaegers
ajaegers / wp-config.php
Last active August 29, 2015 14:13
[Fix] Wordpress HTTPS detection improved (detects https under haproxy HTTP_X_FORWARDED_PROTO). Fix redirects.
//
// Best way to fix it even it'll never been fixed in WordPress core
if ($_SERVER['HTTP_PROXY_HTTPS'] == 'https') $_SERVER['HTTPS']='on';
//
// OR
//
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS']='on';
@ajaegers
ajaegers / configuration.php
Created January 22, 2015 15:40
[Fix] Joomla HTTPS detection improved (detects https under haproxy HTTP_X_FORWARDED_PROTO). Fix redirects.
<?php
if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS']='on';
class JConfig {
/* default datas */
@ajaegers
ajaegers / .htaccess
Created March 5, 2015 10:16
Maintenance page with whitelist ip
# banvhost begin
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^NUM\.NUM\.NUM\.NUM\.
#RewriteRule ^.* http://example.com/maintenance.html [P,L]
RewriteCond %{REQUEST_URI} !^/maintenance/
RewriteRule ^.* /maintenance/ [R,L]
# banvhost end
@ajaegers
ajaegers / git forget
Created April 4, 2015 15:10
Making git forget a file that was tracked but is now in .gitignore
git rm -r --cached .
git add .
git commit -am "Remove ignored files"
@ajaegers
ajaegers / wordpress_global_variables.php
Last active August 29, 2015 14:19
Wordpress common global variables phpDoc declaration for easiest development
/** @var WP $wp */
/** @var wpdb $wpdb */
/** @var WP_Locale $wp_locale */
/** @var WP_Query $wp_query */
/** @var WP_Query $wp_the_query */
/** @var WP_Rewrite $wp_rewrite */
/** @var WP_Roles $wp_roles */
/** @var WP_Widget_Factory $wp_widget_factory */
/** @var WP_Post $post */
/** @var WP_Embed $wp_embed */
@ajaegers
ajaegers / style.css
Created April 23, 2015 11:31
CSS3 : Inverse dom elements with flex
/**
* Inverse dom elements for mobile display
* @link with the help of http://www.alsacreations.com/tuto/lire/1493-css3-flexbox-layout-module.html
*/
.media-inverse {
display: flex;
flex-wrap: wrap-reverse;
}
.media-inverse > div {
width: 100%;
@ajaegers
ajaegers / keyboard-navigation-debug.js
Created May 7, 2015 11:25
Debugging keyboard navigation
// Debugging keyboard navigation:
document.addEventListener('keyup', function () {
console.log(document.activeElement)
})
@ajaegers
ajaegers / inf-install-wp-cli.sh
Last active August 29, 2015 14:20
One command to install WP-CLI on hosting using alias (if you cannot move wp-cli.phar in PATH)
echo '1. Downloading WP-CLI in ~/bin/...' \
&& cd ~ && mkdir bin && cd bin \
&& curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
&& chmod +x wp-cli.phar \
&& echo '2. WP-CLI test...' \
&& php wp-cli.phar --info \
&& echo '3. Making wp alias...' \
&& echo "alias wp='php ~/bin/wp-cli.phar'" >> ~/.bash_aliases \
&& source ~/.bash_aliases \
&& echo '4. Making bash wp alias to be available on each login...' \