Skip to content

Instantly share code, notes, and snippets.

do not pull or push

Torsten Brieskorn bitkorn

do not pull or push
Block or report user

Report or block bitkorn

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bitkorn / ZF2_log-SQL-string-with-driver-support.php
Created Jul 23, 2017
ZF2 log SQL string with driver-support
View ZF2_log-SQL-string-with-driver-support.php
namespace BitkornShop\Table\Basket;
use Zend\Db\Adapter\Adapter;
use Zend\Db\ResultSet\HydratingResultSet;
use Zend\Db\TableGateway\AbstractTableGateway;
use Zend\Db\Adapter\AdapterAwareInterface;
bitkorn / zf2_short_fetch_all_tablex.php
Last active Feb 24, 2017
Short way to fetch all from SQL database with ZF2 \Zend\Db\Adapter\Adapter (no ZF2 \Zend\Db\TableGateway\AbstractTableGateway).
View zf2_short_fetch_all_tablex.php
namespace Foo;
use Zend\Db\Adapter\Adapter;
use Zend\Db\Adapter\ParameterContainer;
class A
View zf2_table_lastInsertValue.php
* @param array $data
* @return int
public function insertSomeAndGetLastInsertValue(array $data)
$insert = $this->sql->insert();
View zf2_base-url_in_controller_and_view.php
$uri = $this->getRequest()->getUri();
$base = sprintf('%s://%s', $uri->getScheme(), $uri->getHost());
// or
$serverUrlHelper = $this->getServiceLocator()->get('ViewHelperManager')->get('ServerUrl');
$url = $serverUrlHelper($this->url()->fromRoute('some_routename'));
// or in view
echo $this->serverUrl($this->url('some_routename'))
View call_invoke_method_of_a_class_member.php
class A
* @var \SomeNamespace\SomeMember
private $someMember;
bitkorn / shop_article_join_with_count.sql
Created Nov 4, 2016
SELECT tables and JOIN over other and COUNT some table rows
View shop_article_join_with_count.sql
-- without DISTINCT comes false results
COUNT(DISTINCT sagr.shop_article_group_relation_id) AS count_group_relation,
COUNT(DISTINCT sai.shop_article_image_id) AS count_image,
COUNT(DISTINCT sar.shop_article_relation_id) AS count_relation,
COUNT(DISTINCT sasi.shop_article_size_item_id) AS count_size_item,
COUNT(DISTINCT sacomm.shop_article_comment_id) AS count_comment
View Module-PHP-getViewHelperConfig_ViewHelper-with-URL-ViewHelper.php
class Module implements Zend\ModuleManager\Feature\ViewHelperProviderInterface
public function getViewHelperConfig()
return array(
'factories' => [
'simpleAnchor' => function(\Zend\View\HelperPluginManager $hpm) {
$sm = $hpm->getServiceLocator();
bitkorn / mysql_enum_values.sql
Last active Oct 29, 2016
get possible ENUM values from a MySQL table column
View mysql_enum_values.sql
-- @return(raw) ('firstenumvalue','secondenumvalue','...')
-- cut the word 'enum'
TABLE_SCHEMA = 'schemaname'
AND TABLE_NAME = 'tablename'
AND COLUMN_NAME = 'columnname';
bitkorn / db.local.php
Last active Oct 27, 2016
ZF2 multiple database conf
View db.local.php
* first DBConfig
$dbParamsGlobal = array(
'hostname' => 'localhost',
'database' => 'somedbname',
'username' => 'root',
'password' => 'secretpasswd',
bitkorn / toggleW3.CSS-dropdown.js
Last active Oct 27, 2016
toggle W3.CSS dropdown with jQuery
View toggleW3.CSS-dropdown.js
function toggleW3(id) {
var toggleme = $("#" + id);
toggleme.css("z-index", 5);
if (!toggleme.hasClass("w3-show")) {
$("#" + id).addClass("w3-show");
$("#" + id).css("z-index", "1");
$("#" + id).removeClass("w3-hide");
var elementId = "";
$(".w3-dropdown-content").each(function (index, element) {
elementId = $(element).attr("id");
You can’t perform that action at this time.