Skip to content

Instantly share code, notes, and snippets.

View ktomk's full-sized avatar

Tom Klingenberg ktomk

  • lastflood GmbH (et al.)
View GitHub Profile
@ktomk
ktomk / bitbucket_load_all_diffs.js
Created October 1, 2019 14:13 — forked from asev/bitbucket_load_all_diffs.js
Bitbucket load all diffs in pull request
/* Add this line to bookmarks and use when you see
* "Oops! You've got a lot of code in this diff and it couldn't load with the page."
* on a pull request at Bitbucket.
*/
javascript:(function(){[].forEach.call(document.querySelectorAll(".load-diff"),function(a){a.click()})})();
PHPUnit_Extensions_TicketListener
PHPUnit_Extensions_PhptTestSuite
PHPUnit_Extensions_TestDecorator
PHPUnit_Extensions_RepeatedTest
PHPUnit_Extensions_PhptTestCase
PHPUnit_Extensions_GroupTestSuite
PHPUnit_Util_Printer
PHPUnit_Util_Test
PHPUnit_Util_Configuration
PHPUnit_Util_Blacklist
#!/bin/bash
#
# de-execute all executable files that are either zero width or don't have a shebang (Magic Line)
#
# note: no explicit non-binary check ( -not -exec grep -vIq . "{}" \; )
#
echo -n "before: "; find . \( -name '.git' -o -name 'bin' \) -prune -o -type f -executable -print | wc -l
find . \( -name '.git' -o -name 'bin' \) -prune -o -type f -executable \
@ktomk
ktomk / EXAMPLE
Last active February 28, 2017 20:28
check di.xml files for wrongfully FQCNs
$ php -f magento2/check.php -- magento2/www
magento2/www/vendor/magento/module-wishlist/etc/di.xml (3):
- /config/preference[1]/@type on line 9: \Magento\Wishlist\Model\AuthenticationState
- /config/preference[2]/@type on line 10: \Magento\Wishlist\Controller\WishlistProvider
- /config/type[3]/plugin/@type on line 22: \Magento\Wishlist\Controller\Index\Plugin
magento2/www/vendor/magento/module-catalog/etc/di.xml (7):
- /config/type[43]/plugin/@type on line 382: \Magento\Catalog\Model\Plugin\ShowOutOfStockConfig
- /config/preference[40]/@type on line 459: \Magento\Catalog\Model\ProductLink\Attribute
- /config/preference[44]/@type on line 463: \Magento\Catalog\Model\CategoryLinkManagement
- /config/preference[47]/@type on line 466: \Magento\Catalog\Model\CategoryLinkRepository
@ktomk
ktomk / git-bl.sh
Last active April 20, 2016 05:10
gitbl - git branch list : review all non master / develop branches, sortable-by-time
#!/bin/bash
git_list_branches()
{
git branch | awk -F ' +' '! /^\(no branch\)|master|develop$/ {print $2}' | sort
}
git_contains_branches()
{
git branch --contains "${1}" | awk -F ' +' '! /^\(no branch\)$/ {print $2}' | sort
@ktomk
ktomk / PHPUnit_ExceptionTrap.php
Created March 20, 2016 12:00
PHPUnit_ExceptionTrap
<?php
class PHPUnit_ExceptionTrap
{
/**
* @var PHPUnit_Framework_TestCase
*/
private $testCase;
/**
@ktomk
ktomk / download.sh
Last active November 4, 2015 22:19 — forked from tkn98/download.sh
download job for not yet mirrored magento installs
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
wget -nc https://github.com/OpenMage/magento-mirror/archive/1.9.1.1.zip
wget -nc https://github.com/OpenMage/magento-mirror/archive/1.9.1.0.zip
wget -nc https://github.com/OpenMage/magento-mirror/archive/1.9.0.1.zip
wget -nc https://github.com/OpenMage/magento-mirror/archive/1.8.1.0.zip
wget -nc https://github.com/ktomk/magento-mirror/archive/1.8.0.0.zip
wget -nc https://github.com/OpenMage/magento-mirror/archive/1.9.1.1.tar.gz
@ktomk
ktomk / session_id_validator_fragment.php
Created October 7, 2011 15:02
Validate a PHP session id string
<?php
/**
* validate string session id
*
* @see http://www.devnetwork.net/viewtopic.php?f=34&t=88685#p520259
*
* @param string $sessionId
* @return bool
*/
public function isValidId($sessionId)
@ktomk
ktomk / valid_utf8_bytes.php
Created October 4, 2011 19:10
filter valid utf-8 byte sequences
<?php
/**
* filter valid utf-8 byte sequences
*
* take over all valid bytes, drop an invalid sequence until first
* non-matching byte, start over at that byte.
*
* @param string $str
* @return string
*/
@ktomk
ktomk / str_ureplace.php
Created July 6, 2011 14:59
str_ureplace - str_replace with callback functions
<?php
/**
* str_ureplace
*
* str_replace like function with callbacks for replacement(s).
*
* @param string|array $search
* @param callback|array $replace
* @param string|array $subject
* @param int $replace_count