Skip to content

Instantly share code, notes, and snippets.

View ssddanbrown's full-sized avatar

Dan Brown ssddanbrown

View GitHub Profile
@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 / 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 / docker-compose.yml
Last active February 6, 2025 06:11
bookstack-npm-docker-compose
---
version: "2"
services:
bookstack:
image: lscr.io/linuxserver/bookstack
container_name: bookstack
environment:
- PUID=1000
- PGID=1000
- APP_URL=https://wiki.bookstackapp.com
@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 / functions.php
Created January 6, 2022 22:13
BookStack Webhook Call Before Hook Example
<?php
use BookStack\Actions\Webhook;
use BookStack\Entities\Models\Page;
use BookStack\Facades\Theme;
use BookStack\Theming\ThemeEvents;
Theme::listen(ThemeEvents::WEBHOOK_CALL_BEFORE, function (string $event, Webhook $webhook, $detail) {
@ssddanbrown
ssddanbrown / examples.md
Created February 3, 2022 22:52
BookStack Laravel Examples

Originally put together when submitting to laravelexamples.com

I'm not particularly proud of the code-base in terms of cleanliness and style, but I'm proud of where it's got to over the last 6 years. Over those years my experience, knowledge and opinions have changed; And the code-base can often reflect that as inconsistency.

@ssddanbrown
ssddanbrown / bs.postman_collection.json
Created February 10, 2022 12:33
BookStack Postman Collection
{
"info": {
"name": "BookStack REST API",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "DOCS",
"item": [
{
@ssddanbrown
ssddanbrown / bookstack-backup.sh
Last active May 18, 2025 17:40
bookstack-backup
#!/bin/bash
# Directory to store backups within
# Should not end with a slash and not be stored within
# the BookStack directory
BACKUP_ROOT_DIR="$HOME"
# Directory of the BookStack install
# Should not end with a slash.
BOOKSTACK_DIR="/var/www/bookstack"
<?php
namespace App\Services;
use Closure;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Http\Client\Response;
use Illuminate\Support\Facades\Http;
@ssddanbrown
ssddanbrown / more_mdn_no_w3schools.goggle
Created July 27, 2022 10:41
Brave Search Goggle: More MDN, No W3Schools
! name: More MDN, No W3Schools
! description: Rerank results to remove W3Schools results while promoting MDN results
! public: true
! author: ssddanbrown
! avatar: #8cb4ff
$boost=4,site=developer.mozilla.org
$discard,site=w3schools.com