Skip to content

Instantly share code, notes, and snippets.

View ajaegers's full-sized avatar

Arnaud JAEGERS ajaegers

View GitHub Profile
@ajaegers
ajaegers / js-regex-replace-links-to-markdown
Created June 17, 2014 11:10
Regex Html link to Markdown syntax
@ajaegers
ajaegers / git-move-files-in-subfolder.md
Last active February 17, 2024 13:28
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 / 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); }
@ajaegers
ajaegers / certbot-renew
Last active December 2, 2021 23:11
Simple Certbot (Let's Encrypt) script for auto-renewal certificates
# Put this file in folder /etc/cron.d/
MAILTO="debug@example.com"
0 1 * * * root /usr/local/sbin/certbot-renew.sh
@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;
@ajaegers
ajaegers / git-up.sh
Last active August 28, 2018 13:58
Simple way to get all your local Git branches up to date
#!/bin/bash
# Simple way to get all your local branches up to date
# Ps: Add this to your .bash_profile or other file as a global helper
function _gitup(){
branches=`git branch`;
current_branch=null;
git_status=`git status -s`;
has_stashed=false;
@ajaegers
ajaegers / MyHelpers.gs
Created March 1, 2017 21:19
My usefull Google Sheets macros
/**
* A special function that runs when the spreadsheet is open, used to add a
* custom menu to the spreadsheet.
*/
function onOpen() {
var spreadsheet = SpreadsheetApp.getActive();
var menuItems = [
{name: "Unquote.li / Generate mysql insert on update from selection", functionName: "unquoteGenMySqlInsert_"}
];
spreadsheet.addMenu('MyHelpers', menuItems);
@ajaegers
ajaegers / vanilla.js
Created December 9, 2016 15:16
Javascript Vanilla functions
function hasClass(el, className) {
return el.classList ? el.classList.contains(className) : new RegExp('\\b' + className + '\\b').test(el.className);
}
function addClass(el, className) {
if (el.classList) el.classList.add(className);
else if (!hasClass(el, className)) el.className += ' ' + className;
}
function removeClass(el, className) {
@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 / app.js
Created December 9, 2016 15:14
Javascript template / Basic module pattern
/**
* Global module
* @source https://addyosmani.com/resources/essentialjsdesignpatterns/book/
*/
var App = (function () {
// Module object
var module = {},
privateVariable = "Hello World";