This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Loan | |
{ | |
private $book; | |
private $time; | |
private static $faketime; | |
public function __construct(Book $book) | |
{ | |
$this->book = $book; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class AnotherExample extends AbstractMarker | |
{ | |
// override | |
public function before() | |
{ | |
// runs before benchmarking | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
var_dump(true + true); // int(2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Node | |
{ | |
public $name; | |
public $children; | |
public function __construct($name) | |
{ | |
$this->name = $name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Node | |
{ | |
public $name; | |
public $linked = array(); | |
public function __construct($name) | |
{ | |
$this->name = $name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Node | |
{ | |
public $linked = array(); | |
public $name; | |
public function __construct($name) | |
{ | |
$this->name = $name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Ball | |
{ | |
public $dataSets = array(); | |
public function run($input) | |
{ | |
$this->set($input); | |
$results = array(); | |
foreach ($this->dataSets as $d) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'digest/md5' | |
require 'find' | |
Find.find(File.dirname($0)) do |path| | |
next if File.directory?(path) | |
puts Digest::MD5.hexdigest(File.read(path)) + ' ' + path | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'optparse' | |
class Diff | |
def initialize(new, old, delimiter = ' ') | |
@new = new | |
@old = old | |
@delimiter = delimiter | |
end | |
def file_each_line(file) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Permutation | |
{ | |
public static function instance() { return new self(); } | |
public function run(Array $nums, $depth, Array $path = array()) | |
{ | |
if (count($nums) < $depth) throw new Exception(); | |
if ($depth === 0) return array($path); | |
$ret = array(); | |
for ($i = 0; $i < count($nums); $i++) { |