Skip to content

Instantly share code, notes, and snippets.

View pixeline's full-sized avatar
😄
Heaven, I'm in heaven, And my heart beats so that I can hardly speak !

Alexandre Plennevaux pixeline

😄
Heaven, I'm in heaven, And my heart beats so that I can hardly speak !
View GitHub Profile
@pixeline
pixeline / dabblet.css
Created September 6, 2013 06:35
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
@pixeline
pixeline / ios-web-app.html
Last active January 23, 2018 12:47 — forked from tfausak/ios-8-web-app.html
iOS Web App + Startup Images, for up to iphone 5 + ipad retina. Works as-is for Wordpress theme header.php
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta content="yes" name="apple-mobile-web-app-capable">
<title>iOS Web App</title>
<link rel="shortcut icon" href="<?php echo get_template_directory_uri(); ?>/favicon.ico">
@pixeline
pixeline / index.html
Last active May 26, 2019 03:44
Simple way to implement a stylesheet switcher, using jquery and proper html. Add your stylesheets to your <head> tag: <link rel="alternate stylesheet" title="red" href="css/red.css" type="text/css"> Include the jquery stylesheet switcher. Done.
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<link rel="stylesheet" title="main" href="normalize.min.css" type="text/css">
<link rel="stylesheet" title="main" href="main.css" type="text/css">
<link rel="alternate stylesheet" title="red" href="red.css" type="text/css">
<link rel="alternate stylesheet" title="blue" href="blue.css" type="text/css">
@pixeline
pixeline / .gitignore
Last active February 8, 2025 23:26 — forked from redoPop/.gitignore
Default Wordpress .gitignore file
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@pixeline
pixeline / server-logs-viewer.php
Last active May 1, 2023 18:25
This script presents the latest lines of your LAMP server log files, emulating the tail() function. Layout is nice and responsive. I chose to include inline the CSS and JS to have the ease-of-use of a single, "drop-in", file. If your site is hosted on a Gandi Simplehosting server, it should just work out of the box.
<?php
/*
@name Server Logs Viewer
@description Emulates the tail() function. View the latest lines of your LAMP server logs in your browser.
@author Alexandre Plennevaux (pixeline.be)
@team Oleg Basov ([email protected])
@date 16.12.2015
*/
@pixeline
pixeline / functions.php
Last active January 23, 2018 12:46
Optimized Wordpress "pre_get_posts" boilerplate
<?php
// In your theme's functions.php file.
add_action( 'pre_get_posts', 'alter_the_main_query' );
function alter_the_main_query( $wp_query ){
if(is_admin() || !$wp_query->is_main_query()){
// pre_get_posts is launched on ALL requests. So we get out early if this is a wp-admin url request or if this is not the main query.
return;
}
@pixeline
pixeline / ajax-handler-wp.php
Last active October 5, 2022 13:09
Custom ajax handler for Wordpress. Using admin-ajax.php, as is usually recommended, is very slow and does not allow the use of plugin shortcodes. Using a custom ajax handler like this bypasses that. http://wordpress.stackexchange.com/questions/170808/the-content-shows-shortcode-instead-of-parsing-it
<?php
/*
WORDPRESS SPECIFIC AJAX HANDLER (because admin-ajax.php does not render plugin shortcodes).
by [email protected]
credits: Raz Ohad https://coderwall.com/p/of7y2q/faster-ajax-for-wordpress
*/
//mimic the actual admin-ajax
define('DOING_AJAX', true);
if (!isset( $_REQUEST['action']))
<VirtualHost *:80>
ServerAdmin template.email
ServerName template.url
ServerAlias www.template.url
# redirect www.domain.tld to domain.tld
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.(.+) [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,QSA,R=301]
@pixeline
pixeline / script.sh
Last active March 23, 2022 17:22 — forked from thimbl/script.sh
#!/bin/bash
# script automatisant la création d'un compte hébergé: utilisateur + dossier + virtualhost
# Enter dummy password if you wish to attach domain to an existing user.
: '
HOW-TO
$ bash /home/pixeline/bin/create-hosting-user username password domain.tld
Arguments:
@pixeline
pixeline / purge.php
Last active January 23, 2018 12:45
Clears serverside caches (finetuned for wordpress on gandi.net simplehosting instances): Varnish, APC, WP Transients, WP Super Cache, W3 Total Cache
<?php
/* purge.php
* Clears serverside caches (finetuned for wordpress on gandi.net simplehosting instances): Varnish, APC, WP Transients, WP Super Cache, W3 Total Cache
*/
header("Cache-Control: max-age=1"); // don't cache ourself
error_reporting(E_ALL);
ini_set("display_errors", 1);