Skip to content

Instantly share code, notes, and snippets.

@rchipka
rchipka / acf-gutenburg-blocks.php
Last active April 2, 2018 16:29
ACF integration for WordPress Gutenburg blocks
<?php
add_filter('acf/location/rule_types', function ( $choices ) {
$choices['Gutenburg']['block_type'] = 'Block Type';
return $choices;
}, 10, 1);
add_filter('acf/location/rule_values/block_type', function ( $choices, $data ) {
return
'<input type="text" data-ui="0" data-ajax="0" data-multiple="0" data-allow_null="0" ' .
'id="acf_field_group-location-' . $data['group'] . '-' . $data['id'] . '-value" ' .
@rchipka
rchipka / natural-language-join.js
Last active October 1, 2019 16:16
Concise JavaScript natural language array join sentence
[values.pop(), values.join(', ')].filter(v => v).reverse().join(' and ')
// ['this'] => 'this'
// ['this', 'that'] => 'this and that'
// ['this', 'that', 'the other'] => 'this, that and the other'
@rchipka
rchipka / cubic-bezier.scss
Created February 7, 2018 21:15
SASS cubic bezier function for precalculated CSS easing
@function pow($number, $exponent) {
$value: 1;
@if $exponent > 0 {
@for $i from 1 through $exponent {
$value: $value * $number;
}
}
@return $value;