Skip to content

Instantly share code, notes, and snippets.

View bastianallgeier's full-sized avatar
🎯
Focusing

Bastian Allgeier bastianallgeier

🎯
Focusing
View GitHub Profile
title: Some title
date: 2018-03-12
Text: Lorem ipsum …
<?php
// no
return [
'aVeryLongOptionKey' => 'some value',
'foo' => 'another value'
];
// yes
return [
<?php
require 'kirby/bootstrap.php';
$kirby = kirby();
$site = site();
foreach (page('posts')->children() as $post) {
// do something with the post here.
}
@bastianallgeier
bastianallgeier / create.php
Last active July 13, 2017 14:19
Kirby CRUD
<?php
// create a main page
try {
$newPage = site()->children()->create($uid = 'test', $template = 'test', [
'title' => 'A page title',
'date' => '2016-02-21',
'text' => 'Lorem ipsum dolor set amet ...'
]);
} catch(Exception $e) {
<?php
return [
'props' => [
'title' => [
'type' => 'field',
'required' => true,
],
'links' => [
'type' => 'structure',
@bastianallgeier
bastianallgeier / graphql.js
Created April 26, 2017 09:01
GraphQL micro client
// Client
const query = (query, data, headers) => {
return fetch('/api', {
method: 'POST',
headers: headers || {},
body: JSON.stringify({
query: query,
variables: data
})
}).then((response) => {
@bastianallgeier
bastianallgeier / ifttt-instagram-to-blog.php
Last active July 21, 2017 06:59 — forked from brendandawes/ifttt-instagram-to-blog.php
IFTTT Make channel action to create blog post from new post on Instagram
<?php
/* if this script is located in your document root… */
require(__DIR__ . '/kirby/bootstrap.php');
if(get('params')) {
$articles = page('blog')->children();
$sort = ($articles->count() + 1);
$date = date('Y-m-d');
<?php
return [
'title' => [
'text' => 'Widget title',
'link' => 'some/url'
],
'options' => [
'text' => 'Edit',
'icon' => 'pencil',
/* Grid */
.grid {
font-size: 0;
}
.grid > .column {
position: relative;
display: inline-block;
width: 100%;
font-size: 1rem;
vertical-align: top;

Kirby 2.3.0

Highlights

New Thumb API

Your Kirby installation now comes with an on-demand image resizer API:

http://yourdomain.com/projects/project-a/forrest.jpg?w=300&amp;h=200&amp;crop=true&amp;bw=true