Skip to content

Instantly share code, notes, and snippets.

View pierrebilac's full-sized avatar

Pierre Bilac pierrebilac

View GitHub Profile
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
<?php
namespace ExampleBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use ExampleBundle\Form\EventListener\addTranslatedFieldSubscriber;
@gyrus
gyrus / shortcodes.php
Last active June 11, 2018 20:40
TinyMCE button for WordPress shortcode
<?php
/**
* Skeletal sample shortcode
*/
add_shortcode( 'pilau-sample', 'pilau_sample_shortcode' );
function pilau_sample_shortcode( $atts ) {
extract( shortcode_atts( array(
'text' => ''
), $atts ) );
@clemherreman
clemherreman / gist:0079334759272518f9d3
Last active October 8, 2019 13:09
CLI xdebug distant VM
alias phpdebug='PHP_IDE_CONFIG="serverName=website.dev" XDEBUG_CONFIG="idekey=PHPSTORM" php -d xdebug.remote_host=10.0.2.2 -d xdebug.remote_connect_back=0'
@GaryJones
GaryJones / phpmd.xml
Created September 12, 2014 15:04
PHPMD Ruleset for a WordPress Theme
<?xml version="1.0"?>
<ruleset name="phpmd.xml"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>PHPMD Ruleset for a WordPress Theme</description>
<rule ref="rulesets/cleancode.xml/BooleanArgumentFlag" />
<rule ref="rulesets/cleancode.xml/ElseExpression" />
<rule ref="rulesets/cleancode.xml/StaticAccess" />
@guillaumewuip
guillaumewuip / post-receive
Last active November 1, 2023 16:54
Git post-receive hook : build then run a docker container
#!/usr/bin/env bash
# A git post-receive hook
#
# On master branch only :
# 1. It builds a docker image named with the dir name
# 2. It then stop container of the same name, rm it and start a new one
## --- Config
@codeinthehole
codeinthehole / osx_bootstrap.sh
Last active May 19, 2024 20:47
Script to install stuff I want on a new OSX machine
#!/usr/bin/env bash
#
# Bootstrap script for setting up a new OSX machine
#
# This should be idempotent so it can be run multiple times.
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
# - Twitter (app store)
@jaredatch
jaredatch / gist:7f0aa8eefe19a3a937b1
Created June 10, 2015 20:34
Extract YouTube ID from URL
<?php
/**
* Fetch YouTube ID from URLs
*
* @param string $url
* @return string
*/
function ja_youtube_id( $url ){
$regex = '~(?:http|https|)(?::\/\/|)(?:www.|)(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[a-z0-9;:@#?&%=+\/\$_.-]*~i';
$id = preg_replace( $regex, '$1', $url );
@brombal
brombal / acf-wysiwyg-style-select.php
Created February 17, 2016 20:54
Custom Styles Dropdown for ACF Wysiwyg Editors (WP Plugin)
<?php
/**
* Plugin Name: ACF Wysiwyg Style Select
* Description: Custom style select boxes for ACF Wysiwyg editors.
* Author: Alex Brombal
* Author URI: http://www.brombal.com
* Version: 1.1
* License: MIT
*/
@bkozma
bkozma / gist:e7483b65c27664bf848ca4f540fea1b7
Last active September 25, 2023 09:30
ACF WYSIWYG Editor Customization example
<?php
//ACF Editor customization
function mindset_toolbars( $toolbars )
{
// Uncomment to view format of $toolbars
/*
echo '< pre >';
print_r($toolbars);
echo '< /pre >';