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 craft\helpers\App; | |
return [ | |
'id' => App::env('CRAFT_APP_ID') ?: 'CraftCMS', | |
'components' => [ | |
'log' => [ | |
'targets' => [ | |
function() { |
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
const original = new URL('https://foo.com/boo/bar/baz/boo?qux'); | |
const kvData = {}; | |
kvData.redirects = [ | |
{ | |
// expected result: https://foo.com/boo/baz/boo | |
from: '^/(foo|boo)/bar/(.*)', | |
to: '/$1/$2', | |
status: 301, | |
pathOnly: true, |
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 | |
/** | |
* Site URL Rules | |
* | |
* You can define custom site URL rules here, which Craft will check in addition | |
* to routes defined in Settings → Routes. | |
* | |
* Read all about Craft’s routing behavior, here: | |
* https://craftcms.com/docs/4.x/routing.html | |
*/ |
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 craft\helpers\App; | |
use craft\log\Dispatcher; | |
use craft\log\MonologTarget; | |
use Illuminate\Support\Collection; | |
use Monolog\Formatter\LineFormatter; | |
use Psr\Log\LogLevel; | |
use yii\i18n\PhpMessageSource; | |
use yii\web\HttpException; |
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
services: | |
bref: | |
build: | |
context: bref | |
image: bref/php-82-fpm-dev:2 | |
container_name: ddev-${DDEV_SITENAME}-bref | |
expose: | |
- "8000" | |
volumes: | |
- ${DDEV_APPROOT}:/var/task:ro |
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 {httpbis} from 'http-message-signatures'; | |
function createMyVerifier() { | |
return { | |
id: 'test-key', | |
algs: ['hmac-sha256'], | |
async verify(data, signature, parameters) { | |
const keyData = new TextEncoder().encode('123456789'); | |
const algorithm = { name: 'HMAC', hash: 'SHA-256' }; | |
const key = await crypto.subtle.importKey('raw', keyData, algorithm, false, ['verify']); |
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 | |
return [ | |
'*' => [], | |
'dev' => [ | |
'container' => [ | |
'definitions' => [ | |
\craft\awss3\Fs::class => static function($container, $params, $config) { | |
$bucket = $config['bucket']; | |
$subfolder = $config['subfolder']; |
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 modules\appmodule\services; | |
use aelvan\imager\Imager; | |
use Craft; | |
use craft\base\Element; | |
use craft\elements\Asset; | |
use craft\elements\db\ElementQuery; | |
use craft\elements\db\MatrixBlockQuery; | |
use craft\elements\Entry; |
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
#!/usr/bin/env zsh | |
# Start configuration added by Zim install {{{ | |
# ------- | |
# Modules | |
# ------- | |
# Sets sane Zsh built-in environment options. | |
zmodule environment | |
# Provides handy git aliases and functions. |
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 | |
class UserBehavior exends \yii\base\Behavior | |
{ | |
public bool $myDynamicallyAddedProp = false; | |
} | |
$user = new \yii\web\User(); | |
$user->attachBehavior('myUser', UserBehavior::class); | |
// I want to have $user be aware of myDynamicallyAddedProp, without having to "@var User|UserBehavior". |
NewerOlder