Skip to content

Instantly share code, notes, and snippets.

View nicooprat's full-sized avatar

Nico Prat nicooprat

View GitHub Profile
@nicooprat
nicooprat / register-custom-blocks.php
Created October 22, 2018 14:17
Registering Gutenberg blocks with ACF blocks
function my_acf_block_render_callback( $block ) {
$slug = str_replace('acf/', '', $block['name']);
$block['slug'] = $slug;
$block['classes'] = implode(' ', [$block['slug'], $block['className'], $block['align']]);
echo \App\template("blocks/${slug}", ['block' => $block]);
}
add_action('acf/init', function() {
if( function_exists('acf_register_block') ) {
// Look into views/blocks
@nicooprat
nicooprat / testimonial.blade.php
Last active April 2, 2020 02:39
Custom Gutenberg bloc with Roots Sage & Blade
{{--
Title: Témoignage
Description: test
Category: formatting
Icon: admin-comments
Keywords: testimonial quote
--}}
<blockquote data-{{$block['id']}} class="{{$block['classes']}}">
<p>{{the_field('testimonial')}}</p>
@nicooprat
nicooprat / custom-callback.php
Last active October 22, 2018 16:42
Create an ACF block
function my_acf_block_render_callback( $block ) {
$slug = str_replace('acf/', '', $block['name']);
if( file_exists(STYLESHEETPATH . "/template-parts/block/content-{$slug}.php") ) {
include( STYLESHEETPATH . "/template-parts/block/content-{$slug}.php" );
}
}
- pipeline: "Push staging"
trigger_mode: "ON_EVERY_PUSH"
ref_name: "dev"
ref_type: "BRANCH"
target_site_url: ""
actions:
- action: "Composer"
type: "BUILD"
working_directory: ""
docker_image_name: "library/php"
@nicooprat
nicooprat / .gitignore
Created March 9, 2018 16:17
NPM scripts and environment variables
.npmrc
@nicooprat
nicooprat / .htaccess
Created July 17, 2017 08:10
W3 Total Cache conf
# BEGIN W3TC Browser Cache
<IfModule mod_mime.c>
AddType text/css .css
AddType text/x-component .htc
AddType application/x-javascript .js
AddType application/javascript .js2
AddType text/javascript .js3
AddType text/x-js .js4
AddType text/html .html .htm
AddType text/richtext .rtf .rtx
@nicooprat
nicooprat / config-1.json
Created July 14, 2017 13:44
1. Config without French | 2. With French
{
"version": 8,
"id": "osm-liberty",
"name": "OSM Liberty",
"metadata": {
"mapbox:type": "template"
},
"sources": {
"natural_earth_shaded_relief": {
"maxzoom": 6,
@nicooprat
nicooprat / blocks.php
Last active February 25, 2018 18:45
Simple PHP block yielding system
<?php
function block($slug, $params = array()) {
global $_SLUG_;
global $_PARAMS_;
$_SLUG_ = $slug;
$_PARAMS_ = $params;
ob_start();
@nicooprat
nicooprat / barba.js
Created February 4, 2017 10:13
Concept for Barba v2
// Internally, do something like this
Promise
.all([
this.loadNewContent,
this.transitionOut({
fromRoute,
event,
oldContainer,
promise
@nicooprat
nicooprat / README.md
Last active September 14, 2016 16:02
Atom theme

Atom theme, based on the default one.

Custom title bar activated (Mac OS only).

More infos here: atom/atom#10208

It's globally more compact (tabs, panes, ...) that the original one. It's made for an use of 1 pane or 2 panes horizontally split. Might have bugs in any other configuration.

Atom