Skip to content

Instantly share code, notes, and snippets.

View pronto2000's full-sized avatar

Tanel Raja pronto2000

View GitHub Profile
<?php
$fp = fopen('input.txt', 'r');
$data = [];
$cmds = [];
while (($line = fgets($fp, 64)) !== false) {
if (strpos($line, '[') !== false) {
$data[] = str_split($line);
} elseif (strpos($line, 'move') !== false) {
preg_match('/move (\d+) from (\d+) to (\d+)/', $line, $matches);
$cmds[] = $matches;
@pronto2000
pronto2000 / products.php
Last active June 12, 2016 14:02
Magento: Snippet to update all products (put it into the shell folder)
<?php
require_once 'abstract.php';
class Mage_Shell_Products extends Mage_Shell_Abstract
{
private function execution_time($start, $current)
{
return date("H:i:s", $current - $start);
}