Skip to content

Instantly share code, notes, and snippets.

View ssddanbrown's full-sized avatar

Dan Brown ssddanbrown

View GitHub Profile
@ssddanbrown
ssddanbrown / update-validation.php
Created November 5, 2021 00:26
Update Laravel Validation to be array-based
<?php
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__));
/** @var SplFileInfo $file */
foreach ($iterator as $file) {
$filePath = $file->getRealPath();
if ($file->getFilename() === 'update.php' || $file->isDir()) continue;
// Get controller file content and find validation rules
@ssddanbrown
ssddanbrown / readme.md
Last active August 28, 2025 09:49
bookstack-npm-docker-compose

This has been removed since it's not actively maintained, and was providing outdated information.

The BookStack project maintains a linuxserver.io based example stack compose config here.

For using with nginx-proxy-manager (to get HTTPS) you could refer to this video here. Note: This is a bit outdated also though, especially for the docker config itself so don't follow that.

If you really want to see the last outdated state of this file, it can be seen here.

@ssddanbrown
ssddanbrown / functions.php
Created June 28, 2021 19:42
BookStack root URI page search via theme functions file
<?php
use BookStack\Entities\Models\Page;
use BookStack\Theming\ThemeEvents;
use BookStack\Facades\Theme;
use Illuminate\Http\Request;
// This will be the content of the functions.php file you'll have
// after following the getting started instructions here:
// https://github.com/BookStackApp/BookStack/blob/release/dev/docs/logical-theme-system.md
@ssddanbrown
ssddanbrown / example.js
Last active February 5, 2021 22:07
Get export-like HTML using the API
// The BASE_URL of your BookStack instance, no trailing slash
const baseUrl = 'http://bookstack.local';
//////////////////
// USAGE EXAMPLE
///
// Get the export content for page ID 4
@ssddanbrown
ssddanbrown / docker-compose.yml
Created January 16, 2021 11:45
LSIO BookStack & Swag Setup
---
version: "2.1"
services:
swag:
image: ghcr.io/linuxserver/swag
container_name: swag
cap_add:
- NET_ADMIN
environment:
- PUID=1000
@ssddanbrown
ssddanbrown / update-bookstack.sh
Last active November 18, 2020 23:23 — forked from codemicro/update-bookstack.sh
Update a BookStack installation while also talking a backup
#!/bin/bash
# BookStack backup & update script
# Forked from codemicro: https://gist.github.com/codemicro/f9dc94ecf5831772e1bff92dfba337d0
########### CONFIG ###########
# Configure this to be the location where BookStack is installed.
# Do not include a trailing slash
BOOKSTACK_DIR="/var/www/bookstack"
@ssddanbrown
ssddanbrown / foo.php
Last active May 14, 2020 21:15 — forked from kritschy/foo.php
<?php
// Alter these to your instance, do not share publicly like this.
$base_api_url = 'http://bookstack.local/api/';
$token_id='ZNI62nNoghS3GyfzThlZFXqYNtHdHnM6';
$token_secret='zPffPZ1ATQcv4Nz75QYLEbMm6fPzmo7I';
// Id of the shelf we want to add our book to.
$shelfId = 12; // $_POST["category"]
@ssddanbrown
ssddanbrown / export-books.php
Last active November 20, 2024 13:05
BookStack-Export-Books
#!/usr/bin/env php
<?php
// API Credentials
// You can either provide them as environment variables
// or hard-code them in the empty strings below.
$apiUrl = getenv('BS_URL') ?: ''; // http://bookstack.local/
$clientId = getenv('BS_TOKEN_ID') ?: '';
$clientSecret = getenv('BS_TOKEN_SECRET') ?: '';
@ssddanbrown
ssddanbrown / docker-compose.yml
Created March 8, 2020 13:17
BookStack docker-compose windows setup example
---
version: "2"
services:
bookstack:
image: linuxserver/bookstack
container_name: bookstack
environment:
- PUID=1000
- PGID=1000
- DB_HOST=bookstack_db
@ssddanbrown
ssddanbrown / custom-head-content.html
Created June 20, 2019 19:56
Hide BookStack Login Form
<style>
form[action$="/login"], form[action$="/login"] + hr {
display: none;
}
form[action$="/login"] + hr + div {
margin-top: 24px;
}
</style>