Skip to content

Instantly share code, notes, and snippets.

Avatar

Artur Bodera Thinkscape

View GitHub Profile
@Thinkscape
Thinkscape / Ext.bugfix.GridFilterBase.js
Last active Aug 29, 2015
Add support for configurable filter "property"
View Ext.bugfix.GridFilterBase.js
/**
* 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 Oct 9, 2014
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.
View Ext.bugfix.BufferedRender.js
/**
* 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 Aug 29, 2015
Fix reading of entities containing "length" property.
View Ext.bugfix.Reader.js
/**
* 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 Sep 24, 2014
Allow configurable filter date format in Ext.grid.filters.filter.Date
View Ext.bugfix.GridFilterDate.js
/**
* 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 Nov 25, 2015
Get random item from Doctrine2 repository
View getRandomDoctrineItem.php
<?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 Aug 29, 2015
PHP-based cpu speed test. It'll attempt to detect number of cpu cores available and run PI calc.
View speedTest.php
<?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 Aug 29, 2015
tooltip-group support for angular-strap
View tooltipGroup.js
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 Sep 8, 2020 — 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.
View open-webinspector.applescript
#!/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
View not-prefixed.php
<?php
namespace Foo {
class Bar {
public function baz() {
return strlen('Regarding the overhead: Just keep in mind, that a typical application calls built-in functions many thousand times. Even if the difference is small: It exists.');
}
}
$start = microtime(true);
$foo = new Bar;
View OUTPUT
string(50) "The url we are looking for: https://github.com?abc"
string(46) "The url after parsing: https://github.com?abc="
URL has been broken during parsing
string(42) "Url before sending: https://github.com?100"
string(42) "Url after sending: https://github.com?100="
URL has been changed when sending request!
You can’t perform that action at this time.