This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
ASSET_PATH='./public/assets' | |
UPDATE_PATHS=('./content' './resources') | |
# Make sure we are in project root | |
if ! grep --quiet 'statamic/cms' composer.json 2> /dev/null | |
then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import crypto from 'crypto' | |
import parseSignedRequest from './parseSignedRequest.mjs' | |
import { instance as fileStorage } from '../ConfirmingFileStorage.mjs' | |
import { getLogger } from '../logger.mjs' | |
import { toAbsoluteUrl } from '../util.mjs' | |
const logger = getLogger('deletionEndpoint') | |
export function registerHandles (app) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Util; | |
class UriBuilder | |
{ | |
private string|null $protocol; | |
private string|null $host = null; | |
private array $path_segments = []; | |
private array $query_parameters = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Ensures that text is readable on any background. | |
Stolen from https://stackoverflow.com/questions/23968961/css-how-can-i-make-a-font-readable-over-any-color#43135326 | |
*/ | |
@mixin readable-shadow($size, $color: white) { | |
text-shadow: | |
#{0.01 * $size}em 0 $color, | |
0 #{0.01 * $size}em $color, | |
#{-0.01 * $size}em 0 $color, | |
0 #{-0.01 * $size}em $color, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function readCsv(string $filepath, string $separator = ';'): array | |
{ | |
$csv = file_get_contents($filepath); | |
$lines = explode("\n", $csv); | |
$head = str_getcsv(array_shift($lines), $separator); | |
$data = []; | |
$lineNumber = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Illuminate\Http\Response; | |
use Illuminate\Support\Facades\Storage; | |
use Symfony\Component\HttpFoundation\StreamedResponse; | |
/** | |
* Similar to Storage::download, but serves the file as a stream. | |
* | |
* Stolen and adapted from stackoverflow.com/questions/44965777/laravel-5-file-downloads-stream-or-download |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM php:8-cli | |
VOLUME /app | |
WORKDIR /app | |
RUN apt update && apt install -y \ | |
tini \ | |
libonig-dev \ | |
&& rm -rf /var/lib/apt/lists/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM composer:2 | |
FROM php:8-cli | |
COPY --from=composer /usr/bin/composer /usr/bin/composer | |
VOLUME /app | |
WORKDIR /app | |
RUN apt update && apt install -y \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Idea stolen from https://stackoverflow.com/questions/610839/how-can-i-programmatically-create-a-new-cron-job#13355743 | |
addCronjob() { | |
user=$(whoami) | |
(crontab -u "$user" -l 2>/dev/null || echo '' ; echo "$1") \ | |
| sort - \ | |
| uniq - \ |
OlderNewer