Skip to content

Instantly share code, notes, and snippets.

View pierrehenri220's full-sized avatar

Peter (ピエール) pierrehenri220

View GitHub Profile
@pierrehenri220
pierrehenri220 / build_openlitespeed_centos.sh
Last active May 15, 2021 15:15
Build OpenLiteSpeed 1.6.21 on CentOS
#!/bin/bash -ev
yum install wget
wget https://openlitespeed.org/packages/openlitespeed-1.6.21.src.tgz
yum install tar
tar -zxvf openlitespeed-1.6.21.src.tgz
cd openlitespeed-1.6.21
./build.sh
./install.sh
@pierrehenri220
pierrehenri220 / barba-settings.js
Created December 6, 2016 01:25
Update html head tags with Barba.js
Barba.Dispatcher.on('newPageReady', function(currentStatus, oldStatus, container, newPageRawHTML) {
// html head parser borrowed from jquery pjax
var $newPageHead = $( '<head />' ).html(
$.parseHTML(
newPageRawHTML.match(/<head[^>]*>([\s\S.]*)<\/head>/i)[0]
, document
, true
)
);
var headTags = [
@pierrehenri220
pierrehenri220 / cf_tunnels2csv.js
Created April 5, 2020 11:29
ClickFunnels Tunnels to CSV generator
var csv = [];
$( '.sortingGroups .groupForFunnel' ).each(function() {
csv.push( $( this ).find( '.title' ).html() + "\n");
$( this ).find( '.groupFunnels .pageListingItem' ).each(function() {
csv.push( [
$( this ).find( '.pageListingTitle a' ).html(),
$( this ).find( '.pageListingTitle a' ).attr( 'href '),
$( this ).find( '.funnelStatSmall' ).text()
].join( "\t" ) + "\n" );
});
@pierrehenri220
pierrehenri220 / wp_plugins-list_dumper.js
Last active April 5, 2019 08:43
List Wordpress plugins used. Open the plugin page and copy-paste the snippet on your browser developer tools
var html = [];
jQuery( 'tr.active:not(.plugin-update-tr)' ).each(function() {
html.push([
'-'
, jQuery( this ).find( 'td.plugin-title > strong' ).html()
, jQuery( this ).find( '.plugin-version-author-uri' ).text().split( '|' )[ 0 ]
].join(' '));
});
console.log( html.join( "\n" ) );
@pierrehenri220
pierrehenri220 / single.php
Last active March 2, 2018 00:16
Markdown Output
<?php
<div class="entry-content">
echo markdown( get_the_content() );
</div>
<div class="entry-extra">
echo markdown( get_field( 'my_custom_field' ) );
</div>
?>
@pierrehenri220
pierrehenri220 / functions.php
Last active March 2, 2018 00:05
Markdown without using JetPack
require_once get_template_directory() . '/inc/php-markdown-1.8.0/Michelf/Markdown.inc.php';
use MichelfMarkdown;
function markdown( $str ) {
return Markdown::defaultTransform( $str );
}
@pierrehenri220
pierrehenri220 / git_init.sh
Created February 28, 2018 01:37
Initialize a git repository into a non empty directory
git init
git remote add origin git@github.com:USER/REPOSITORY.git
git pull origin master
@pierrehenri220
pierrehenri220 / test-email.php
Created November 19, 2017 06:47
Simple PHP Mail test
<?php
# Source: https://www.conetix.com.au/support/article/simple-php-mail-test
# Howto: ssh login, then php test-email.php
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = "emailtest@YOURDOMAIN";
$to = "YOUREMAILADDRESS";
$subject = "PHP Mail Test script";
$message = "This is a test to check the PHP Mail functionality";
$headers = "From:" . $from;
@pierrehenri220
pierrehenri220 / functions.php
Created November 14, 2016 10:01
Wordpress upload kmz / kml files
function add_upload_mimes($mimes=array()) {
$mimes['kml']='application/vnd.google-earth.kml+xml';
$mimes['kmz']='application/vnd.google-earth.kmz';
return $mimes;
}
add_filter("upload_mimes","add_upload_mimes");
@pierrehenri220
pierrehenri220 / codekit_coda2_hook
Last active February 21, 2017 16:08
Codekit Hook: Trigger Coda 2 Publication
delay 0.05
tell application "Coda 2" to activate
tell application "System Events"
keystroke "p" using {command down, control down}
end tell