Skip to content

Instantly share code, notes, and snippets.

View rasteiner's full-sized avatar

Roman Steiner rasteiner

  • Toast Communication Lab
  • Switzerland
View GitHub Profile
@rasteiner
rasteiner / BundleReader.php
Last active September 20, 2023 15:24
JCR bundle reader in php
<?php
enum BundleNames: int {
case NT_UNSTRUCTURED = 0;
case NT_RESOURCE = 1;
case NT_FILE = 2;
case NT_FOLDER = 3;
case NT_HIERARCHYNODE = 4;
case MIX_REFERENCEABLE = 5;
case JCR_CREATED = 6;
@rasteiner
rasteiner / release-plugin.php
Created October 5, 2022 12:43
kirby cli plugin version bump command
<?php
return [
'description' => 'Release a new version of your plugin',
'args' => [
'bump' => [
'description' => 'The type of version bump to perform',
],
],
'command' => static function ($cli): void {
@rasteiner
rasteiner / i.php
Created October 3, 2022 16:01
Interactive shell for kirby cli
<?php
namespace rasteiner\kirby\cli\interactive;
class Shell {
public function __autocomplete(string $str): array {
$info = readline_info();
$line = $info['line_buffer'];
$pos = $info['end'];
$line = substr($line, 0, $pos);
@rasteiner
rasteiner / schema.json
Created January 31, 2022 14:44
Kirby page blueprint schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "getkirby.com/schema/v3/blueprints/page",
"type": "object",
"$defs": {
"tabs": {
"type": "object",
"description": "Tabs are used to group related content. They can be used to create a tabbed navigation.",
"additionalProperties": {
"$ref": "#/$defs/tab"
@rasteiner
rasteiner / .stubs.php
Created August 14, 2021 16:03
Stubs for Kirby 3 aliased classes
<?php
/**
* @copyright Copyright (c) 2021 Bastian Allgeier
* @author Bastian Allgeier
* @link http://getkirby.com/
* @license http://getkirby.com/license/
*/
/**
* Anything in your public path can be converted
@rasteiner
rasteiner / index.php
Created May 14, 2019 16:51
fields shortcut
<?php
use Kirby\Cms\PageBlueprint;
class shortcutsPreset {
static private $counter = 0;
static private function randomSectionName() {
self::$counter += 1;
return 'shortcuts_preset_section_' . self::$counter;
}
function APACHE {
docker run -d --rm -p 80:80 -v "${PWD}:/var/www/html" rasteiner/phpapache-for-devs
}
function APACHE7 {
docker run -d --rm -p 80:80 --env XDEBUG_CONFIG="remote_enable=0 profiler_enable=0" -v "${PWD}:/var/www/html" rasteiner/phpapache-for-devs:php7
}
function APACHE7-DEBUG {
$HostIP = ( `
@rasteiner
rasteiner / emojis.php
Last active July 18, 2018 13:15
create an emoji detecting regex
<?php
$data = explode("\n", file_get_contents('https://unicode.org/Public/emoji/11.0/emoji-data.txt'));
$ranges = [];
$toint = function($str) {
return intval($str, 16);
};
foreach ($data as $line) {
$line = trim(preg_replace('/[#;].*/', '', $line));
/// illustrator script stub - converts paths to ... something else
var items = app.activeDocument.pageItems;
var strlog = '';
var ops = [];
function log(str) {
strlog+= "\n" + str;
}
@rasteiner
rasteiner / key_mac.pub
Last active August 29, 2015 14:19
add my public key to your authorized hosts.
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC0JCmGBzKdsused0xlCcTfJEFQl02q44UB37+Uu1yBGarnxYINaJ3OxG6Zysvtiuh4u7gpS7+OOsVKeMyNXcZqRPDINFaZXgCYSkA9t5d/RwSVnNLVZeb1oiaRrmtko3dG+TXkDergjV9Lxbnt4T2I3HPrI8bxfwBzZaj782EUjX7WiylPM+K+jaOVBMPQLifIyvD/GazP0hhQmpBXz6vNCHg5VzWZWKgIGdEqexihU3ysvhvB2xVRGuJ1wPGBQfEpdRJs1qjDK5cgTJWovNbtQs28786YjhYVlo6lVy1i8FJLX3P0J4BE2X1S9kKIdqO0s8nCVCXRmGW1beclzzlL roman@romac.local