Skip to content

Instantly share code, notes, and snippets.

View Thinkscape's full-sized avatar

Arthur Bodera Thinkscape

View GitHub Profile
@Thinkscape
Thinkscape / gist:4a414653a7945d315f36
Created March 10, 2015 14:52
DoctrineORMModule issue #383
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1130] Host 'REDACTED' is not allowed to connect to this MySQL server' in /Users/Thinkscape/Documents/Projects/REDACTED/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php on line 909
PDOException: SQLSTATE[HY000] [1130] Host 'REDACTED' is not allowed to connect to this MySQL server in /Users/Thinkscape/Documents/Projects/REDACTED/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php on line 43
Call Stack:
0.0002 227872 1. {main}() /Users/Thinkscape/Documents/Projects/REDACTED/shell:0
0.0004 231880 2. include('/Users/Thinkscape/Documents/Projects/REDACTED/public/index.php') /Users/Thinkscape/Documents/Projects/REDACTED/shell:4
0.0037 525376 3. Zend\Mvc\Application::init() /Users/Thinkscape/Documents/Projects/REDACTED/public/index.php:10
0.0605 4600776 4. Zend\Mvc\Application->bootstrap() /Users/Thinkscape/Documents/Projects/REDACTED/vendor/zendframework/
@Thinkscape
Thinkscape / flattenExceptionBacktrace.php
Last active December 28, 2023 12:28
Make any PHP Exception serializable by flattening complex values in backtrace.
<?php
function flattenExceptionBacktrace(\Exception $exception) {
$traceProperty = (new \ReflectionClass('Exception'))->getProperty('trace');
$traceProperty->setAccessible(true);
$flatten = function(&$value, $key) {
if ($value instanceof \Closure) {
$closureReflection = new \ReflectionFunction($value);
$value = sprintf(
'(Closure at %s:%s)',
@Thinkscape
Thinkscape / Ext.bugfix.GridFilterBase.js
Last active August 29, 2015 14:07
Add support for configurable filter "property"
/**
* Add support for configurable filter "property"
*/
Ext.define('Ext.bugfix.GridFilterBase', {
override: 'Ext.grid.filters.filter.Base',
config: {
/**
* @cfg {String} property
* The property name to use when creating a filter
@Thinkscape
Thinkscape / Ext.bugfix.BufferedRender.js
Created October 9, 2014 08:11
Work around trees/grids that will not render correctly in case they are hidden from the view (i.e. in a Tab) but data has changed.
/**
* Work around trees/grids that will not render correctly in case they are hidden from the view (i.e. in a Tab) but
* data has changed.
*/
Ext.define('Ext.bugfix.BufferedRenderer', {
override: 'Ext.grid.plugin.BufferedRenderer',
getLastVisibleRowIndex: function() {
var result = this.callParent(arguments);
@Thinkscape
Thinkscape / Ext.bugfix.Reader.js
Last active August 29, 2015 14:06
Fix reading of entities containing "length" property.
/**
* Fix reading of entities containing "length" property
*
* @link http://www.sencha.com/forum/showthread.php?292395-data.Reader-throwing-exception-when-model-contains-quot-length-quot-field.&p=1067807
* @link https://fiddle.sencha.com/#fiddle/at6
*/
Ext.define('Ext.bugfix.Reader', {
override: 'Ext.data.reader.Reader',
extractData: function(root, readOptions) {
@Thinkscape
Thinkscape / Ext.bugfix.GridFilterDate.js
Created September 24, 2014 11:38
Allow configurable filter date format in Ext.grid.filters.filter.Date
/**
* Allow configurable date format when creating a store filter.
*
* To set a global default app-wise, include this fix and use something like:
*
* Ext.grid.filters.filter.Date.prototype.dateWriteFormat = 'c';
*
*/
Ext.define('Ext.bugfix.GridFilterDate', {
override: 'Ext.grid.filters.filter.Date',
@Thinkscape
Thinkscape / getRandomDoctrineItem.php
Last active November 25, 2015 11:59
Get random item from Doctrine2 repository
<?php
use Doctrine\ORM\EntityManager;
/**
* Retrieve one random item of given class from ORM repository.
*
* @param EntityManager $em The Entity Manager instance to use
* @param string $class The class name to retrieve items from
* @return object
*/
@Thinkscape
Thinkscape / speedTest.php
Last active August 29, 2015 13:56
PHP-based cpu speed test. It'll attempt to detect number of cpu cores available and run PI calc.
<?php
/**
* Usage:
*
* php speedTest.php [ITERATIONS] [CONCURRENCY]
*
* ITERATIONS - (optional) Number of iterations (PI digits) to compute.
* Values above 10000 can seriously hog your machine.
* CONCURRENCY - (optional) Number of CPU cores to use. If empty,
* it's going to attempt to detect the number.
@Thinkscape
Thinkscape / tooltipGroup.js
Last active August 29, 2015 13:56
tooltip-group support for angular-strap
module.directive('tooltipGroup', [
var popoverRegistry = {};
var suspend = false; // semaphore used to prevent circular calling of hide triggers
function(){
return {
restrict : 'A',
priority : 1,
link : {
pre : function ($scope, el, attrs, formCtrl) {
// $scope.artifactPickerSelectOptions = artifactPicker.getSelectOptions();
@Thinkscape
Thinkscape / open-webinspector.applescript
Last active September 8, 2020 01:34 — forked from amuino/webinspector.applescript
Script for opening web inspector window for remote debugging iOS web apps (including phonegap and other webview apps). This version of the script will suspend and wait for 30 seconds for Safari to establish a connection with the device (or simulator) and open the web inspector window as soon as technically possible.
#!/usr/bin/osascript
# Name of the device as visible in Safari->Develop menu
set deviceName to "iPhone Simulator"
# Number of seconds to wait for the simulator window to show up
set maxWait to 30
# ---------------------------------------
# You shouldn't modify anything below here