Skip to content

Instantly share code, notes, and snippets.

View iVariable's full-sized avatar

Vladimir Savenkov iVariable

View GitHub Profile
@iVariable
iVariable / combinations.php
Last active November 21, 2016 20:00
Combinations for Slavik
<?php
function countChange($desiredResult, $typeOfCoins)
{
if ($desiredResult <= 0) return 0;
if (empty($typeOfCoins)) return 0;
if (count($typeOfCoins) == 1) {
return ($desiredResult % $typeOfCoins[0] == 0) ? 1 : 0;
}
<?php
if ($argc < 3) die('Provide trace file and filter');
$file = $argv[1];
$filter = $argv[2];
$f = fopen($file, 'r');
if (!$f) die('Couldn\'t open file for reading');
fgets($f); //Useless header
<?php
require_once __DIR__ . '/bootstrap.php.cache';
require_once __DIR__ . '/AppKernel.php';
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
$kernel = new AppKernel('test', true);