Skip to content

Instantly share code, notes, and snippets.

View jlambe's full-sized avatar
🤔

Julien Lambé jlambe

🤔
View GitHub Profile
@jlambe
jlambe / flat.php
Created March 24, 2022 08:25
Flatten data objects
<?php
class PostContentData {
public function __construct(
public string $excerpt,
public string $content,
) {}
}
class SettingsData {
@jlambe
jlambe / wp-cli.txt
Created January 28, 2017 07:25
WP-CLI install unit tests example
bash bin/install-wp-tests.sh wordpress_test root '' localhost latest
@jlambe
jlambe / .htaccess
Created January 23, 2017 16:49
Protect readme.md and composer.json files
# Protect all readme.md files.
<Files ~ "\.md$">
Order allow,deny
Deny from all
</Files>
# Protect access to all composer.json files.
<Files ~ "composer\.json$">
Order allow,deny
Deny from all
@jlambe
jlambe / gist:a868d9b63d70902a12254ce47069d0e6
Created May 13, 2016 06:57
Twig - POEdit configuration
Create a Poedit project for your theme if you haven't already, and make sure to add __ on the Sources keywords tab and other gettext functions declared in WordPress: _e, ...
Go to Edit->Preferences.
On the Parsers tab, add a new parser with these settings:
Language: Twig
List of extensions: *.twig
Parser command: xgettext --language=Python --add-comments=TRANSLATORS --force-po -o %o %C %K %F
An item in keyword list: -k%k
An item in input files list: %f
Source code charset: --from-code=%c
Save and Update!
@jlambe
jlambe / application.config.php
Last active March 11, 2016 09:36
Themosis framework 1.2.3 core aliases.
'aliases' => [
'Action' => 'Themosis\\Facades\\Action',
'Ajax' => 'Themosis\\Facades\\Ajax',
'Asset' => 'Themosis\\Facades\\Asset',
'Config' => 'Themosis\\Facades\\Config',
'Controller' => 'Themosis\\Route\\Controller',
'Field' => 'Themosis\\Facades\\Field',
'Form' => 'Themosis\\Facades\\Form',
'Html' => 'Themosis\\Facades\\Html',
'Input' => 'Themosis\\Facades\\Input',
@jlambe
jlambe / TaxField.php
Created October 7, 2015 05:23
Taxonomy custom fields. Handles only text and media fields. Values are saved inside the options table.
<?php
namespace Themosis\Taxonomy;
/**
* TaxField class
*
* Allow the user to add custom fields to a taxonomy.
*/
class TaxField
@jlambe
jlambe / PHP Configuration
Last active April 23, 2016 05:09
PHP 5.6.20 Configuration - El Capitan
./configure --with-openssl=/usr/local/opt/openssl --with-libxml-dir=/usr/local/opt/libxml2 --enable-mbstring --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pear=/usr/local --with-pdo-mysql=mysqlnd --with-mysql-sock=/var/mysql/mysql.sock
@jlambe
jlambe / html5_template.html
Created August 17, 2012 13:25 — forked from nathansmith/html5_template.html
Simple HTML5 Template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge, chrome=1" />
<title>untitled</title>
<link rel="stylesheet" href="" />
</head>
<body>