Skip to content

Instantly share code, notes, and snippets.

View jbutkus's full-sized avatar

Justas Butkus jbutkus

  • Vilnius, Lithuania
View GitHub Profile
@jbutkus
jbutkus / indentation.php
Created May 7, 2014 13:31
Indentation according to guidelines
<?php
if (
foo() ||
bar()
) {
$this->_registry->get( 'foo.bar' )
->do_action()
->chain_call();
if ( foo() ) {
<?php
$dispatcher = new Ai1ec_Event_Dispatcher();
$callback_filter = new Ai1ec_Event_Callback_Filter( $this->_registry, 'model.settings', 'modify2' );
$dispatcher->register( 'title', $callback_filter, 19, 2 );
$callback_filter2 = new Ai1ec_Event_Callback_Filter( $this->_registry, 'model.settings', 'modify' );
$dispatcher->register( 'title', $callback_filter2, 17, 2 );
@jbutkus
jbutkus / apc.php
Created March 12, 2013 11:27
I always fail to *google* this one
<?php
/*
+----------------------------------------------------------------------+
| APC |
+----------------------------------------------------------------------+
| Copyright (c) 2006-2011 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
@jbutkus
jbutkus / mem_by_ref.php
Created November 27, 2012 15:30
Check memory consumption, when one large blob is refered via object
<?php
$start_memory = memory_get_usage( true );
$generic_info = new stdClass();
$generic_info->name = 'generic_info';
$generic_info->hash = str_repeat( 'XOR', 333 );
$objects_list = array();
for ( $index = 0; $index < 10000; $index++ ) {