Skip to content

Instantly share code, notes, and snippets.

<?php
class SignedUrlGenerator {
private $secretKey;
private $hashAlgorithm;
public function __construct($secretKey) {
$this->secretKey = $secretKey;
$this->hashAlgorithm = 'sha256';
}
<?php
class RequestVerifier {
private $secretKey;
private $hashAlgorithm;
public function __construct($secretKey) {
$this->secretKey = $secretKey;
$this->hashAlgorithm = 'sha256';
}
<?php
class MyAuthMiddleware
{
public static function fetch($request)
{
// You will need some super-secret data to use as a symmetric key.
$secretKey = "my secret symmetric key";
$secretKeyData = mb_convert_encoding($secretKey, 'UTF-8');
function textEncoderEncode($inputString) {
// Convert the string to UTF-8 encoding
$utf8String = mb_convert_encoding($inputString, 'UTF-8');
// Split the string into an array of characters
$characters = preg_split('//u', $utf8String, null, PREG_SPLIT_NO_EMPTY);
// Convert each character to its ASCII value
$encodedArray = array_map('ord', $characters);
<img src=x onerror=alert('caption')>
Event::on(
Users::class,
Users::EVENT_AFTER_ACTIVATE_USER,
function ($event) {
if ($event->user->isInGroup('groupHandle')) {
Craft::$app->getConfig()->getGeneral()->postLoginRedirect = 'specialUserGroupPage';
// redirect to page A
} else {
// redirect to default page
<?php
return [
'currencySymbols' => [
'JPY' => '¥',
],
];

Keybase proof

I hereby claim:

  • I am angrybrad on github.
  • I am takobell (https://keybase.io/takobell) on keybase.
  • I have a public key ASDJlOnxuU7XifxOfBKQ3EB4wZW8AmhFMeR33nr0aMg7vAo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am takobell on github.
  • I am takobell (https://keybase.io/takobell) on keybase.
  • I have a public key whose fingerprint is 9302 1E27 AE90 866A 51E7 A7B1 0682 19F2 F720 99F8

To claim this, I am signing this object:

<?php
namespace Craft;
// Set default timezone to UTC
date_default_timezone_set('UTC');
ini_set('log_errors', 1);
error_reporting(E_ALL & ~E_STRICT);
ini_set('display_errors', 1);