Skip to content

Instantly share code, notes, and snippets.

@jurecuhalev
jurecuhalev / register-block-testimonial.php
Last active February 22, 2022 13:34 — forked from nicooprat/custom-callback.php
Create an ACF block with Sage 9 & Blade
add_action('acf/init', function() {
if( function_exists('acf_register_block') ) {
// Look into views/blocks
$dir = new \DirectoryIterator(\locate_template("views/blocks/"));
// Loop through found blocks
foreach ($dir as $fileinfo) {
if (!$fileinfo->isDot()) {
$slug = str_replace('.blade.php', '', $fileinfo->getFilename());
// Get infos from file
$file_path = \locate_template("views/blocks/${slug}.blade.php");
string = new Promise(function(resolve) {
// original code was just:
// resolve(ctx.processString(contents, relativePath));
//
// I want to emulate that and also invalidate cache in catch()
try {
resolve(ctx.processString(contents, relativePath));
} catch(e) {
return cache.remove(key).then(function(){
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.BasicAuthentication',
'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
'rest_framework.authentication.TokenAuthentication',
),
@jurecuhalev
jurecuhalev / SassMeister-input.scss
Created February 8, 2016 22:56
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
.bla {
font: {
size: 1em;
weight: 400;
};
}
@jurecuhalev
jurecuhalev / script.php
Created January 29, 2014 18:08
Returns results of Wordpress Ninja Forms as AJAX friendly JSON ouput (for angular.js)
<?php
$subs = ninja_forms_get_all_subs( 1 );
$fields = ninja_forms_get_fields_by_form_id( 1 );
$json_data = [];
foreach ($subs as $sub_id => $sub) {
$submission_data = array();
$data = unserialize($sub['data']);
$user_values = array();
foreach ($data as $key => $value) {
@jurecuhalev
jurecuhalev / dabblet.css
Created September 25, 2012 17:11
Untitled
div {width:350px; height:100px; background:lightgray; position:relative; margin:20px;}
div:after{content:''; width:160px; height:2px; background:gray; position:absolute; bottom:-2px; left: 100px}
@jurecuhalev
jurecuhalev / dabblet.css
Created September 25, 2012 17:11
Untitled
div {width:350px; height:100px; background:lightgray; position:relative; margin:20px;}
div:after{content:''; width:60px; height:4px; background:gray; position:absolute; bottom:-4px;}
@jurecuhalev
jurecuhalev / dabblet.css
Created September 25, 2012 17:10
Untitled
div {width:350px; height:100px; background:lightgray; position:relative; margin:20px;}
div:after{content:''; width:60px; height:4px; background:gray; position:absolute; bottom:-4px;}