Skip to content

Instantly share code, notes, and snippets.

View ajaegers's full-sized avatar

Arnaud JAEGERS ajaegers

View GitHub Profile
@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...' \
@ajaegers
ajaegers / update-wp-cli.sh
Created May 25, 2015 15:57
Updating local wp-cli
echo '1. Updating WP-CLI in /usr/local/bin/' \
&& echo '2. Current version: ' \
&& wp --version \
&& cd /usr/local/bin \
&& curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \
&& chmod +x wp-cli.phar \
&& echo '3. WP-CLI test...' \
&& php wp-cli.phar --version \
&& echo '4. Replacing...' \
&& sudo mv wp-cli.phar wp \
@ajaegers
ajaegers / git-move-files-in-subfolder.md
Last active March 16, 2025 18:34
Git: move files in an subfolder keeping history

Change structure of project folder with Git

I have this structure:

 project-folder/
     .git
     wp-admin/
     wp-content/
     wp-includes/

.htaccess

@ajaegers
ajaegers / simple-iframe-cross-domain.html
Created July 9, 2015 13:08
Simple HTML iframe cross domain and immediately accessible
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<iframe name="preview" id="preview" src="javascript:var d=document.open();d.domain='example.com';d.close();void(0);" frameborder="0" height="100%" width="100%" allowfullscreen="true" allowtransparency="true"/>
</body>
</html>
@ajaegers
ajaegers / .htaccess
Created July 15, 2015 07:30
.htaccess Transparent redirect in subfolder
RewriteEngine On
RewriteRule ^$ public/ [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f # if file doesn't exists
RewriteCond %{REQUEST_FILENAME} !-d # if file doesn't exists
RewriteCond %{REQUEST_URI} !^/public # if url without '/public'
RewriteRule ^(.*)$ public/$1 [QSA,L]
@ajaegers
ajaegers / form-input-file.html
Created August 25, 2015 13:00
Html input file for mobile devices via capture attribute
<!-- as seen on http://openweb.eu.org/articles/html-media-capture -->
<form action="index.php" method="post" enctype="multipart/form-data">
<input type="file" name="image" accept="image/*" capture />
<input type="file" name="video" accept="video/*" capture />
<input type="submit" value="Upload" />
</form>
@ajaegers
ajaegers / .htaccess
Created October 11, 2015 14:50
Htaccess alias subdomain redirection in document root subfolder
# SECTION BEGIN SubDomainOnFolder
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(blog|preprod)\.
RewriteCond %{REQUEST_URI} !^/(blog|preprod)/
RewriteCond %{DOCUMENT_ROOT}/%1 -d
RewriteRule ^(.*)$ %1/$1 [L]
# SECTION END SubDomainOnFolder
@ajaegers
ajaegers / command.sh
Created November 26, 2015 15:10
Bash create file and insert multiline content
#!/bin/bash
cat <<EOF > result.txt
Content 1
Content 2
Content 3
Content 4
EOF
@ajaegers
ajaegers / style-animation-rainbow.css
Created December 10, 2015 10:35
Css animation rainbow effect based on rotating hue colors
/**
* Found in http://mapbox.com footer (hover robot)
*/
.element:hover {
-webkit-animation: rainbow 4s steps(36) infinite;
}
@-webkit-keyframes rainbow {
from { -webkit-filter:hue-rotate(10deg); }
to { -webkit-filter:hue-rotate(360deg); }