Skip to content

Instantly share code, notes, and snippets.

View ajaegers's full-sized avatar

Arnaud JAEGERS ajaegers

View GitHub Profile
@ajaegers
ajaegers / jsbin.trigger-css-pseudo-classes-whith-javascript.html
Last active July 4, 2019 07:34
Apply / trigger dynamically css of pseudo classes with javascript (like in console)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style type="text/css">
div {
display: block;
width: 200px;
height: 200px;
/**
* 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 / js-regex-replace-links-to-markdown
Created June 17, 2014 11:10
Regex Html link to Markdown syntax
@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%;