Skip to content

Instantly share code, notes, and snippets.

View neclimdul's full-sized avatar

James Gilliland neclimdul

View GitHub Profile
<?php
namespace Drupal\my_custom;
use Drupal\my_custom\Normalizer\FileEntityNormalizer;
use Drupal\Core\DependencyInjection\ContainerBuilder;
use Drupal\Core\DependencyInjection\ServiceProviderBase;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
<?php
namespace Drupal\custom_dve\Commands;
use Drush\Commands\core\LoginCommands;
use Drush\Commands\DrushCommands;
use Drush\SiteAlias\SiteAliasManagerAwareInterface;
class LoginsCommand extends DrushCommands implements SiteAliasManagerAwareInterface {
@neclimdul
neclimdul / D6FlagBookmarks.php
Created September 27, 2018 17:31
d6_node_flag
<?php
namespace Drupal\my_migration\Plugin\migrate\source;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
/**
* Migrate flags from d6 -> d8.
*
* @MigrateSource(
@neclimdul
neclimdul / composer.json
Created October 30, 2017 16:14
Coder Conflict
{
"name": "neclimdul/coder_conflict",
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"require": {
"drupal/coder": "~8.2.12"
@neclimdul
neclimdul / float_test.txt
Last active July 18, 2017 18:24
Testing float behavior in a couple languages. https://bugs.php.net/bug.php?id=74925
$ cat test.php
<?php
// Extra output to show how php displays things different.
var_dump(54.83 + 0.01);
printf("%.18e\n", 54.83 + 0.01);
var_dump(54.83 + 0.01 == 54.84);
var_dump(3 * 202.3);
printf("%.18e\n", (3 * 202.3));
var_dump((3 * 202.3) == 606.9);
for($v = -1; $v < 0; $v += 0.2){
#!/bin/sh
##
## Script for cleaning up docker images left by normal docker usage.
##
## Copyright 2016 James Gilliland
##
## Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
##
<?php
class myTest extends BrowserTestBase {
/**
* @{@inheritdoc}
*/
protected function tearDown() {
if (function_exists('_drupal_shutdown_function')) {
_drupal_shutdown_function();
<?php
class SecuredRedirectResponseTest extends UnitTestCase {
public function testHeaderBag() {
$headers = ['test'];
$bag1 = new ResponseHeaderBag($headers);
$bag2 = new ResponseHeaderBag($bag1->allPreserveCase());
$this->assertEquals($bag1->allPreserveCase(), $bag2->allPreserveCase());
}
GET http://ec2-54-191-113-78.us-west-2.compute.amazonaws.com/checkout/user/2 returned 0 (0 bytes). Browser PageCacheTagsTestBase.php 51 Drupal\system\Tests\Cache\PageCacheTagsTestBase->verifyPageCache()
Page cache MISS for http://ec2-54-191-113-78.us-west-2.compute.amazonaws.com/checkout/user/2. Other PageCacheTagsTestBase.php 53 Drupal\system\Tests\Cache\PageCacheTagsTestBase->verifyPageCache()
Page cache HIT for http://ec2-54-191-113-78.us-west-2.compute.amazonaws.com/checkout/user/2.
[18:35:40] Log initialized (/var/lib/drupaltestbot/sites/default/files/review.test_1145698.pifr_simpletest.2504513-24.patch.1441848940.log)
[18:35:40] Review timestamp: (Wed, 09/09/2015 - 18:35)
[18:35:40] Review host: (ec2-54-191-113-78)
[18:35:40] Operations:Array
(
drupalci config:show current
---------------- Start config set: CURRENT DCI ENVIRONMENT ----------------
Defined in ~/.drupalci/config:
DCI_TESTGROUPS: Ajax
DCI_UseLocalCodebase: /var/www/localhost/htdocs/d8/
DCI_PHPVersion: 5.6