This file contains 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
trait Subject | |
{ | |
public function initListeners() | |
{ | |
$this->listeners = array(); | |
} | |
public function addListener($listener) | |
{ | |
$this->listeners[] = $listener; |
This file contains 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
# These code may not be a ruby. | |
class AbstractKlass | |
def initialize | |
raise 'Abstract Class !!' | |
end | |
def method_a | |
raise 'Called abstract method !!' | |
end |
This file contains 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
class Report | |
def initialize | |
@title = 'report title' | |
@text = ['text1', 'text2', 'text3'] | |
end | |
def output_report | |
output_start | |
output_body | |
output_end |
This file contains 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
class Formatter | |
def output_report(title, text) | |
raise 'Called abstract method !!' | |
end | |
end | |
class HTMLFormatter < Formatter | |
def output_report(report) | |
puts "<html><head><title>#{report.title}</title></head>" | |
puts '<body>' |
This file contains 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
class Report | |
attr_reader :title, :text | |
attr_accessor :formatter | |
def initialize(&formatter) | |
@title = 'report title' | |
@text = ['text1', 'text2', 'text3'] | |
@formatter = formatter | |
end |
This file contains 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
<div class="masonry"> | |
<article class="masonry-brick"> | |
... | |
</article> | |
<article class="masonry-brick"> | |
... | |
</article> | |
<article class="masonry-brick"> | |
... | |
</article> |
This file contains 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 | |
for ($i = 1; $i <= 100; $i++) echo (($i % 15 === 0) ? 'fizzbuzz' : (($i % 5 === 0) ? 'buzz' : ($i % 3 === 0 ? 'fizz' : $i))) . PHP_EOL; |
This file contains 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
class Wrapper | |
{ | |
private $_obj; | |
public function __construct($obj) | |
{ | |
$this->_obj = $obj; | |
} | |
public function __call($name, $args) |
This file contains 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 | |
// front.php | |
$options = array( | |
'name' => 'ack_queue', | |
'driverOptions' => array( | |
'host' => 'localhost', | |
'port' => '22133', | |
), | |
); |
This file contains 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 MyList implements ArrayAccess | |
{ | |
private $_values; | |
public function __construct($array = array()) | |
{ | |
$this->_values = $array; | |
} |
OlderNewer