View Table.php
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 Drupal\sd8_import\Plugin\migrate\source; | |
use Drupal\migrate\Plugin\migrate\source\SqlBase; | |
/** | |
* Table source from database. | |
* | |
* @MigrateSource( |
View Generate.php
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 | |
// Note this is not a transliterator. See https://unicode-org.github.io/icu/userguide/transforms/general/#overview | |
// on why it was originally named Transliterator but now does a lot more. | |
$transformation = \Transliterator::createFromRules(':: NFD; :: [:Mn:] Remove; :: NFC;'); | |
$letters = preg_grep('/\pL/u', array_map('utf8', range(0x80, 0x2000))); | |
$letters = array_combine($letters, $letters); | |
$transformed = array_map([$transformation, 'transliterate'], $letters); | |
$map = array_diff_assoc($transformed, $letters); | |
print count($map); |
View config.php
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 | |
# put this file in ~/.config/psysh/ | |
if (class_exists('Drupal')) { | |
foreach (\Drupal::entityTypeManager()->getDefinitions() as $definition) { | |
$class = $definition->getClass(); | |
$parts = explode('\\', $class); | |
class_alias($class, end($parts)); | |
} | |
} |
View PauseRedirectRequestSubscriber.php
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 Drupal\pause_redirect\EventSubscriber; | |
use Drupal\Core\Messenger\MessengerInterface; | |
use Drupal\pause_redirect\Form\PauseRedirectSettingsForm; | |
use Drupal\redirect\EventSubscriber\RedirectRequestSubscriber; | |
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |
use Symfony\Component\HttpFoundation\RedirectResponse; | |
use Symfony\Component\HttpKernel\Event\RequestEvent; |
View MapItemTest.php
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 Drupal\Tests\field\Kernel; | |
use Drupal\entity_test\Entity\EntityTestMapField; | |
class MapItemTest extends FieldKernelTestBase { | |
protected function setUp(): void { | |
parent::setUp(); |
View resolve.php
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 Drupal\Core\Serialization\Yaml; | |
include 'autoload.php'; | |
chdir('..'); | |
$old = Yaml::decode(shell_exec('git show origin/master^:' . $argv[1])); | |
$new = Yaml::decode(shell_exec('git show origin/master:' . $argv[1])); | |
$diff = make_diff($new, $old); |
View Redirector.json
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
{ | |
"createdBy": "Redirector v3.5.3", | |
"createdAt": "2020-04-16T03:37:40.345Z", | |
"redirects": [ | |
{ | |
"description": "No more JIRA popups", | |
"exampleUrl": "https://example.atlassian.net/secure/RapidBoard.jspa?rapidView=102&modal=detail&selectedIssue=WEB-8424&quickFilter=107", | |
"exampleResult": "https://example.atlassian.net/browse/WEB-8424", | |
"error": null, | |
"includePattern": "^(.*atlassian.net)/secure/RapidBoard.jspa.*modal=detail&selectedIssue=([^&]+)", |
View gist:9dbace679a8798f96da4a40e4df51902
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
On production: | |
rm -Rf /tmp/cex/* /tmp/cex.tgz | |
drush cex --destination=/tmp/cex -y sync | |
cd /tmp/cex | |
tar czf ../cex.tgz . | |
On local: |
View rest.resource.user_registration.yml
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
To register (admin needs to install rest module, add the registration resource attached, the right registration settings and the user permission 'restful post user_registration' granted to anonymous): | |
➜ curl -H "Content-type: application/json" -X POST 'http://localhost/docroot/user/register?_format=json' --data '{"name":{"value":"test name"},"mail":{"value":"chx1975@gmail.com"},"pass":{"value":"test pass"}}' | |
{"uid":[{"value":14048}],"uuid":[{"value":"6494d669-086a-451f-b7e5-573ffb4e1dfe"}],"langcode":[{"value":"hu"}],"name":[{"value":"test name"}],"created":[{"value":"2020-02-14T05:18:53+00:00","format":"Y-m-d\\TH:i:sP"}],"changed":[{"value":"2020-02-14T05:18:53+00:00","format":"Y-m-d\\TH:i:sP"}],"default_langcode":[{"value":true}],"synonyms":[]}% | |
To log in (unpatched core requires a user name here but I patched it so users can use their email as well): | |
➜ curl -c cookie.txt --request POST 'http://localhost/docroot/user/login?_format=json' --data '{"name":"chx1975@gmail.com","pass":"test pass"}' | |
{"current_ |
View gist:929fbcebc80cc5ead5c6a8684d5a33db
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
To register: | |
➜ fortepan git:(master) ✗ curl -H "Content-type: application/json" -X POST 'http://localhost/fortepan/docroot/user/register?_format=json' --data '{"name":{"value":"test name"},"mail":{"value":"chx1975@gmail.com"},"pass":{"value":"test pass"}}' | |
{"uid":[{"value":14048}],"uuid":[{"value":"6494d669-086a-451f-b7e5-573ffb4e1dfe"}],"langcode":[{"value":"hu"}],"name":[{"value":"test name"}],"created":[{"value":"2020-02-14T05:18:53+00:00","format":"Y-m-d\\TH:i:sP"}],"changed":[{"value":"2020-02-14T05:18:53+00:00","format":"Y-m-d\\TH:i:sP"}],"default_langcode":[{"value":true}],"synonyms":[]}% | |
To log in (unpatched core requires a user name here but I patched it so users can use their email as well): | |
➜ fortepan git:(master) ✗ curl -c cookie.txt --request POST 'http://localhost/fortepan/docroot/user/login?_format=json' --data '{"name":"chx1975@gmail.com","pass":"test pass"}' | |
{"current_user":{"uid":"14048","name":"test name"},"csrf_token":"AH8CpdwKyNdoTI89F3tUypGm470Qi9eQYYbeS-wK7is","logout_token":"NAH- |
NewerOlder