Skip to content

Instantly share code, notes, and snippets.

View ephrin's full-sized avatar
🎯
Focusing

Volodymyr Myrza ephrin

🎯
Focusing
  • Vinnytsia/Ukraine
View GitHub Profile
@ephrin
ephrin / parent.php
Last active December 17, 2015 06:49
call parent::__METHOD__ with func_get_args
$reflect = new \ReflectionClass(get_class($this));
return $reflect->getParentClass()->getMethod(__METHOD__)->invokeArgs($this, func_get_args());
@ephrin
ephrin / parent.php
Last active December 17, 2015 07:39 — forked from shmaltorhbooks/parent.php
!__METHOD__ => __FUNCTION__
$reflect = new \ReflectionClass(get_class($this));
return $reflect->getParentClass()->getMethod(__FUNCTION__)->invokeArgs($this, func_get_args());
@ephrin
ephrin / ArrayHelperInterface.php
Created May 22, 2013 09:58
Test Quest OOP (php version > 5.3)
interface ArrayHelperInterface extends IteratorAggregate,
Traversable,
ArrayAccess,
Serializable,
Countable {
/**
* @param ArrayHelperInterface|ArrayObject|array $array
*/
@ephrin
ephrin / ArrayHelperInterface.php
Last active December 17, 2015 14:39
Test Quest Simple OOP (php version > 5.3)
interface ArrayHelperInterface extends
IteratorAggregate,
ArrayAccess,
Countable {
/**
* @param ArrayHelperInterface|ArrayObject|array $array
*/
function __construct($array);
$array = array('a'=>1,'b'=>2,'c'=>10,'d'=>false,'f'=>6);
$array = new ArrayHelper($array);
$array->some(function($key, $value, ArrayHelperInterface $array){
return $value && is_string($key) && count($array)>$value;
});
@ephrin
ephrin / ArrayHelperInterface.php
Last active December 17, 2015 14:49
Test of test v0.2
$array = array('_0' => 0);
$array = new ArrayHelper($array);
$func = function ($key, $value, ArrayHelperInterface $array) {
static $i;
$i++;
$c = count($array);
if (is_string($key) && $c < $value) {
unset($array[$key]);
@ephrin
ephrin / my.cnf
Created June 5, 2013 11:02
percona my.cnf
# Generated by Percona Configuration Wizard (http://tools.percona.com/) version REL5-20120208
# Configuration name server-22 generated for [email protected] at 2013-02-26 08:48:03
[mysql]
# CLIENT #
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld]
var current = db.getName();
print('logged in from owner. Making auth.');
var adm = db.getSiblingDB('admin');
if(adm.auth('admin','admin')){
print('ok');
}else{
@ephrin
ephrin / .mongorc.js
Last active December 26, 2015 19:39
$c([sort]) Useful for database collections quick information overview. Examples: $c({size:1}) //ascendance sorting by size $c({indSize:-1}) //desc sorting by index size $c({docs:1}) // sorts by documents count output
function cols(sort){
var colNames = new String(db.getCollectionNames()).split(',');
var longest = 0;
colNames.forEach(
function(colname){
if(colname.length > longest){
longest = colname.length;
@ephrin
ephrin / gist:7469586
Created November 14, 2013 16:18
PHPSTORM Annotation types fixes regexps for doctrine methods generator
search: @(return|param) (\w+[\\])
replace: @$1 \\\\$2