Skip to content

Instantly share code, notes, and snippets.

View DominikAngerer's full-sized avatar
🏠
For sure working from somewhere 🤘

DominikAngerer DominikAngerer

🏠
For sure working from somewhere 🤘
View GitHub Profile
@DominikAngerer
DominikAngerer / demo.json
Last active January 24, 2019 18:05
A demo json for integrations
{
"results_size": 166,
"results": [{
"id": "baf0f820-0fff-456f-9256-0da23bafa481",
"image_url": "https://picsum.photos/150/150?v=afa481",
"last_update": 1509364426938,
"title": "Savannah Mcfadden",
"description": "Eiusmod nisi ut ea et duis consectetur in occaecat non culpa. Sit nisi ut velit non id pariatur in esse enim laboris duis sit. Cillum enim elit nulla labore incididunt. Voluptate eu aute velit culpa est et aute do. Lorem id minim commodo et. Voluptate magna tempor sint cillum aute tempor proident cupidatat sint. Mollit officia non nisi id id nulla exercitation et ullamco ut laboris tempor.",
"blob": {
"field": "field",
@DominikAngerer
DominikAngerer / parse-storyblok-comments.php
Last active November 12, 2019 10:39
Manually parse the Storyblok HTML editable comments. Nginx SSI.
<?php
$blok = array("_editable" => "<!--#storyblok#{\"name\": \"column\", \"space\": \"48408\", \"uid\": \"7c44c5d8-0adb-4c01-a797-12d9b300b99b\", \"id\": \"307934\"}-->");
/**
* Manually parse the Storyblok HTML editable comments. Use your templating language to output
* keys = values as html attributes without quotes or with single quotes.
*
* @param array $blok This is your component object
* @param boolean $raw Decide if function should return raw array or inline string
@DominikAngerer
DominikAngerer / storyblok-custom-field-modal-demo.js
Last active January 17, 2019 21:50
Storyblok: Custom Field Modal Demo
<template>
<div>
<div v-show="!modalIsOpen">
Custom field is in sidebar / not in modal
<button @click=openModal>Open</button>
</div>
<div v-if="modalIsOpen">
Custom field is in not in sidebar but in a modal
<button @click=closeModal>Close</button>
</div>
@DominikAngerer
DominikAngerer / language-codes.json
Last active September 28, 2021 09:10
Storyblok Language Codes Array
[ { "af":"Afrikaans" },
{ "sq":"Albanian" },
{ "ar":"Arabic" },
{ "ar_dz":"Arabic (Algeria)" },
{ "ar_bh":"Arabic (Bahrain)" },
{ "ar_eg":"Arabic (Egypt)" },
{ "ar_iq":"Arabic (Iraq)" },
{ "ar_jo":"Arabic (Jordan)" },
{ "ar_kw":"Arabic (Kuwait)" },
{ "ar_lb":"Arabic (Lebanon)" },
@DominikAngerer
DominikAngerer / storyblok-publish-all-in-folder.js
Last active February 9, 2023 17:18
Storyblok: How to publish all content entries in one folder
// # Install Dependencies: ---------------------------------------------------------------
// npm install storyblok-js-client
// # Execute with: -----------------------------------------------------------------------
// node storyblok-publish-all-in-folder.js
// # Configure: --------------------------------------------------------------------------
// ID of space your folder is located in
const space_id = 51455
@DominikAngerer
DominikAngerer / migration.js
Created November 15, 2018 15:11
migration.js
let story = '';
const resolve = (item) => {
if (typeof item.component !== 'undefined' && item.component == 'markdown') {
if (typeof item.margin_top === 'undefined' || item.margin_top == '') {
item.margin_top = 'no-margin-top'
}
// You can send a POST request to the Node Application from your client side application
// during your submit event with the following three examples
// ----------------------------------------------------------------
// Basic XHR Example:
// in your submit event:
var data = JSON.stringify({ "message": "this is the message from the contact form entered by your customer" } );
var xhr = new XMLHttpRequest();
const Fieldtype = {
mixins: [window.Storyblok.plugin],
template: `
<div>
<div class="uk-grid">
<div class="uk-width-1-5" v-if="has_image">
<img :src="model.src"/>
</div>
<div :class="{ 'uk-width-4-5': has_image, 'uk-width-1-1': !has_image }" >
<input class="uk-width-1-1" placeholder="Your image URL" v-model="model.src" />
var request = require("request");
var options = { method: 'POST',
url: 'https://api.storyblok.com/v1/spaces/YOUR_SPACE_ID/stories',
headers:
{ Authorization: 'YOUR_AUTH_TOKEN',
'Content-Type': 'application/json',
Accept: 'application/json' },
body: { story:
{ name: 'Story 1',
var https = require('https')
var querystring = require('querystring')
var AWS = require('aws-sdk')
var responseHeaders = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Credentials': true
}
var storyblokApiRequest = function(inputData, success, error) {
var timestamp = Math.floor(Date.now() / 1000)
var postData = JSON.stringify({