Skip to content

Instantly share code, notes, and snippets.

Jure Cuhalev gandalfar

Block or report user

Report or block gandalfar

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gandalfar
gandalfar / register-block-testimonial.php
Last active Jan 4, 2019 — forked from nicooprat/custom-callback.php
Create an ACF block with Sage 9 & Blade
View register-block-testimonial.php
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");
View code.js
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(){
View settings.py
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',
),
@gandalfar
gandalfar / script.php
Created Jan 29, 2014
Returns results of Wordpress Ninja Forms as AJAX friendly JSON ouput (for angular.js)
View script.php
<?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) {
@gandalfar
gandalfar / SassMeister-input.scss
Created Feb 8, 2016
Generated by SassMeister.com.
View SassMeister-input.scss
// ----
// libsass (v3.2.5)
// ----
.bla {
font: {
size: 1em;
weight: 400;
};
}
View dabblet.css
div {width:350px; height:100px; background:lightgray; position:relative; margin:20px;}
div:after{content:''; width:60px; height:4px; background:gray; position:absolute; bottom:-4px;}
View dabblet.css
div {width:350px; height:100px; background:lightgray; position:relative; margin:20px;}
div:after{content:''; width:60px; height:4px; background:gray; position:absolute; bottom:-4px;}
View dabblet.css
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}
You can’t perform that action at this time.