Skip to content

Instantly share code, notes, and snippets.

working on

Carsten Brandt cebe

working on
Block or report user

Report or block cebe

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
cebe / objectToArray.php
Created Jun 19, 2019
workaround for object to array cast in PHP <7.2.0
View objectToArray.php
// workaround for object to array cast in PHP <7.2.0
private function objectToArray($object)
if (PHP_VERSION_ID < 70200) {
// work around PHP bug
if (is_object($object)) {
cebe / view.php
Created Jun 3, 2019
Bootstrap 3 responsive level indicator
View view.php
<!-- put this code directly after <body> tag, for non-Yii environment, skip the if() statement -->
<?php if (YII_DEBUG): ?>
<!-- bootstrap responsive level indicator, only shown in debug mode -->
<div style="position: fixed; top: 0; left: 0; background: white; border: solid 1px #ccc; width: 25px; height: 18px; text-align: center; font-size: 10px; font-weight: bold; opacity: 0.5; z-index: 10000;" title="bootstrap responsive level indicator">
<span class="visible-xs-inline">xs</span>
<span class="visible-sm-inline">sm</span>
<span class="visible-md-inline">md</span>
<span class="visible-lg-inline">lg</span>
<?php endif; ?>
View Mongodb Cache.php
// My code
if ($this->beginCache('Notifghjgjhgication', ['dependency' => [
'class' => 'yii\caching\DbQueryDependency',
'query' => \app\models\Notifications::find()->where(["receiver_type" => "vendor", "receiver_id" => \Yii::$app->user->identity->_id, 'read_status' => FALSE]),
'method' => 'count',
]])) {?>
<li class="dropdown" id="Notification-list-container">
<?= Yii::$app->runAction('/notification/default/notificationlist') ?>
cebe / abc.sls
Last active Nov 22, 2017 — forked from tom--/abc.sls
View abc.sls
cebe /
Created Oct 25, 2017
quick remote git repo
# prepare server
ssh root@
git init --bare /srv/testrepo.git
# in local repo
git remote add testrepo root@
cebe / neo4j.conf
Created Oct 5, 2017
Neo4j stalt state files
View neo4j.conf
# Neo4j configuration
# For more details and a complete list of settings, please see
# The name of the database to mount
cebe / pdobug.php
Last active Aug 14, 2017
Reproducing a PHP PDO bug
View pdobug.php
$tableSql = <<<SQL
CREATE TABLE `typebug` (
`int_col` integer NOT NULL,
`int_col2` integer DEFAULT '1',
`smallint_col` smallint(1) DEFAULT '1',
`char_col` char(100) NOT NULL,
`char_col2` varchar(100) DEFAULT 'something',
cebe / basicauth.php
Created May 2, 2017
allow basic auth for users not logged in
View basicauth.php
class SomeController extends yii\web\Controller
* @var array actions to authenticate via basicAuth if not logged in.
public $basicAuthActions = [];
View AR.php
use yii\behaviors\TimestampBehavior;
public function behaviors()
return [
'timestamp' => function() {
$b = new TimeStampBehavior();
$b->attributes = [
ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'],
cebe /
Last active Dec 28, 2016
command for finding vulnerable files and line of code for finds also really old versions, e.g. 2.0.4.
for file in $(find /var/www |grep class.phpmailer.php) ; do echo $file; grep -ni '%s["'\''], $this->Sender' $file ; done
You can’t perform that action at this time.