Skip to content

Instantly share code, notes, and snippets.

View sroehrl's full-sized avatar

neoan sroehrl

View GitHub Profile
sroehrl / cli
Created February 12, 2023 00:19
LENKRAD scripts when starting from scratch
View cli
#!/usr/bin/env php
use Neoan\Cli\Application;
use Neoan\Helper\Setup;
use Neoan\NeoanApp;
require_once __DIR__ . '/vendor/autoload.php';
$setup = new Setup();
View AttachUser.php
namespace App\Transformers;
use Josantonius\Session\Facades\Session;
use Neoan\Enums\Direction;
use Neoan\Model\Interfaces\Transformation;
class AttachUser implements Transformation
sroehrl / simple-api-benchmark.js
Created August 6, 2022 19:28
Quick & dirty performance benchmarking for APIs
View simple-api-benchmark.js
* Simple API performance test for comparative benchmarking of GET-calls
* Usage: adjust variables below and then run `node benchmarkIt.js`
* Concurrency is not refilled during a cycle, as some benchmarking scripts do.
* This results in longer overall runtime and yield slower results than most benchmark metrics use.
* A good request-time is therefore ~< 20ms
sroehrl / index.php
Created November 6, 2021 17:50
PHP: Most primitive blog - using less than a total of 75 lines of code (uses as headless CMS)
View index.php
$current = $_GET['entry'] ?? null;
$all = [];
$menu = '';
foreach (glob('archieve/*.json') as $i => $entry) {
$all[] = json_decode(file_get_contents($entry), true);
if (!$current) {
$current = $all[0]['slug'];
// menu
sroehrl / AuthController.php
Created October 18, 2021 19:51
example of neoan3 implementation when using
View AuthController.php
namespace Neoan3\Component\Auth;
use Neoan3\Core\RouteException;
use Neoan3\Frame\Demo;
use Neoan3\Model\User\UserModel;
use Neoan3\Provider\Auth\Authorization;
use Neoan3\Provider\Model\InitModel;
View api.js
let config = {
baseURL: process.env.apiRoute, //http://localhost:3000
timeout: 8000,
headers: {'X-Custom-Header': 'wb-app'}
const API = axios.create(config);
API.interceptors.request.use(exitingConfig => {
exitingConfig.headers.Authorization = `Bearer ${localStorage.token.replace('"','')}`;
View scenario_save-the-cargo.js
let planetIndex = 1;
// the following line does only work on a local system and not online (so only if you check out the repo)
Practice scenario: Retrieve cargo
Click on "execute" to start!
YOUR TASK: use a second ship to retrieve cargo from a rouge drone!
sroehrl / Vagrantfile
Last active February 26, 2021 22:53
Vagrant setup for neoan3 v3
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# neoan3 vagrant box
Vagrant.configure("2") do |config| = "ubuntu/bionic64" "private_network", ip: ""
sroehrl / UserModel.php
Last active January 31, 2021 02:19
Basic user model for neoan3 v3.1
View UserModel.php
/* Generated by neoan3-cli */
namespace Neoan3\Model\User;
use Exception;
use Neoan3\Provider\MySql\Database;
use Neoan3\Provider\Model\Model;
use Neoan3\Provider\MySql\Transform;
sroehrl / index.php
Created April 21, 2020 14:59
View index.php
define('varovalka', true);
include_once 'shared.php';
<!DOCTYPE html>
<html lang="en" dir="ltr">