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
@patrickposner
patrickposner / functions.php
Last active October 18, 2023 21:07
Simply Static: Set up a build to run daily with cron.
<?php
register_activation_hook( __FILE__, 'setup_build_cron' );
/**
* Setup a cron job to run daily.
*
* @return void
*/
function setup_build_cron() {
/*
It's now a package. You can find it here:
https://github.com/joshnuss/svelte-local-storage-store
*/
// Svelte store backed by window.localStorage
// Persists store's data locally
@pixeline
pixeline / function.remove_empty_html_tags.php
Last active April 28, 2019 13:35
PHP function removing all empty html nodes from a given html fragment. Useful for cleaning content entered via WYSIWYG editors.
<?php
function remove_empty_html_tags($html)
{
/**
* PHP function removing all empty html nodes from a given html fragment. Useful for cleaning content entered via WYSIWYG editors.
* source: https://stackoverflow.com/a/42067229/53960
* Regex by Mark Notton
*/
$regex = '~<((?!iframe|canvas)\w+)[^>]*>(?>[\p{Z}\p{C}]|<br\b[^>]*>|&(?:(?:nb|thin|zwnb|e[nm])sp|zwnj|#xfeff|#xa0|#160|#65279);|(?R))*</\1>~iu';
return preg_replace($regex, '', $html);
@MelissaKaulfuss
MelissaKaulfuss / installing_ruby_versions_with_chruby.md
Last active August 4, 2023 19:28
How to install different Ruby versions with chruby

Managing Ruby Versions with chruby

So I'm always forgetting how to do this! I guess I'm only ever updating Ruby versions every now and then.

Checking out which Ruby versions chruby has access to

$ chruby will display your installed rubies and show you the version you're currently using in your shell.

   ruby-2.1.2
   ruby-2.2.1
 ruby-2.3.1
@bouchat-marieange
bouchat-marieange / Hébergeurs gratuits - Free website hosting
Last active October 1, 2023 15:54
Liste des hébergeurs gratuits
**Githubpage**
HTML/CSS/JS - pas de DB
Documentation pour Githubpage : https://help.github.com/articles/what-is-github-pages/
**Infinityfree
https://infinityfree.net/
HTML/CSS/PHP/MySQL
**000webhost**
https://fr.000webhost.com/
@Rayne
Rayne / index.php
Created February 16, 2017 15:18
Fat-Free Framework with PHP Debugger Tracy
<?php
/**
* The following example combines Fat-Free Framework
* with the PHP Debugger (Toolbar) Tracy.
*
* @see https://github.com/bcosca/fatfree/issues/999
*/
use Tracy\Debugger;
@pixeline
pixeline / php_upgrade_to_71.sh
Last active March 16, 2023 16:49
Update Mac Os X's php version to php 7.1 using homebrew. Includes curl and mcrypt
# 1. Install brew --> http://brew.sh/
# 2. run the following commands in your Terminal
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install --with-openssl curl
brew install --with-homebrew-curl --with-apache php71
brew install php71-mcrypt php71-imagick
# 3. Follow these instructions to make Apache and php-cli use the newer php executable and make the change persist after reboot.
brew info php71
@pixeline
pixeline / functions.php
Last active January 23, 2018 12:45
Function to prevent orphans in WordPress post titles. It simply replaces the last space after the penultimate word of a title by a non-breaking space. Pfew.
function add_nonbreaking_space_to_text($title, $id = null){
$title = explode(' ', $title);
$length = count($title);
if( $length >0){
$title[ $length-2 ] .= "&nbsp;" . $title[ $length-1 ];
array_pop($title);
}
return implode(" ", $title);
}
@fiskhandlarn
fiskhandlarn / custom-search-acf-wordpress.php
Last active September 9, 2022 16:40 — forked from jserrao/custom-search-acf-wordpress.php
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request. I updated this original script with better documentation and XSS / SQL injection support.
<?php
/*
##############################
########### Search ###########
##############################
Included are steps to help make this script easier for other to follow
All you have to do is add custom ACF post types into Step 1 and custom taxonomies into Step 10
I also updated this work to include XSS and SQL injection projection
[list_searcheable_acf list all the custom fields we want to include in our search query]
@pixeline
pixeline / siege-urls.php
Last active January 23, 2018 12:45
WP-siege: Generates list of all published URLs from a Wordpress site, for use with Siege.
<?php
/*
*
* WP-siege: Generates list of all published URLs from a Wordpress site, for use with Siege.
* Author: Alexandre Plennevaux alexandre@pixeline.be
*
*/
//path to a wp-load file
include( './wp-load.php' );