Skip to content

Instantly share code, notes, and snippets.

@ak4n
ak4n / symfony.phpunit.xml
Created October 8, 2015 19:33 — forked from havvg/symfony.phpunit.xml
An example PHPUnit configuration file for symfony projects running on 512MB phpUnderControl server
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="true">
<filter>
<blacklist>
@ak4n
ak4n / iterator.php
Last active August 29, 2015 14:27 — forked from piotrpasich/iterator.php
Iterator
<?php
$start = microtime(true);
$mem = memory_get_usage();
function t() {
global $argv;
$array = array();
for ($i = 0; $i < $argv[1]; $i++) {
$array[] = rand(0, 100);
}
@ak4n
ak4n / composer.json
Last active August 29, 2015 14:25 — forked from harikt/composer.json
Fast router benchmark with aura and symfony
{
"require": {
"aura/router":"2.0.*@dev",
"symfony/routing": "3.0.*@dev",
"nikic/fast-route": "dev-master"
}
}
@ak4n
ak4n / README.md
Last active August 29, 2015 14:23 — forked from magnetikonline/README.md
86937 isset
43159 echo
31697 empty
29252 substr
26146 count
24248 is_array
22572 strlen
19365 sprintf
18090 unset
16584 str_replace
#!/usr/bin/env php
<?php
/*
* Coding Standards (a.k.a. CS)
*
* This script is designed to clean up the source files and thus follow coding
* conventions.
*
* @see http://symfony.com/doc/2.0/contributing/code/standards.html
*
<?php
// iterator impl:
class MapIterator extends IteratorIterator {
private $f;
public function __construct($f, $inner) {
parent::__construct($inner);
$this->f = $f;
@ak4n
ak4n / foreach_vs_array_asterix
Last active December 20, 2018 13:00
Benchmarking execution time of PHP constructs (list / each, foreach) vs (array_walk, array_map, array_reduce, array_filter)
<?php
/**
* Execution time check for: (list/each,foreach) vs (array_walk, array_map, array_reduce, array_filter)
* @docs to read
* http://www.giorgiosironi.com/2010/02/stop-writing-foreach-cycles.html
* http://www.pastie.org/829318
* http://php.net/manual/en/function.array-walk.php#112722
* http://zaemis.blogspot.com/2013/06/building-array-with-arrayreduce.html
* (!) http://stackoverflow.com/questions/2473989/list-of-big-o-for-php-functions/2484455#2484455
* http://www.faieta.net/wp/performance-implications-of-closures-in-php/
@ak4n
ak4n / Gruntfile.js
Last active August 29, 2015 14:20 — forked from jshawl/Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sass: {
dist: {
options:{
style:'compressed'
},
files: {
'css/style.css' : 'scss/style.scss'
<snippet>
<content><![CDATA[
<!-- begin $1 -->
<div class="$1">
$2
</div>
<!-- end $1 -->
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>di</tabTrigger>