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 | |
// Define arrays | |
$array1 = new ArrayIterator( array('php', 'perl', 'python', 'c') ); | |
$array2 = new ArrayIterator( array('singleton', 'factory', 'strategy') ); | |
$array3 = new ArrayIterator( array('yellow', 'blue', 'red', 'white') ); | |
// Create iterator and add all arrays to it | |
$iterator = new AppendIterator(); | |
$iterator->append($array1); | |
$iterator->append($array2); |
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 | |
// Display some information about PHP | |
phpinfo(); |
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
#!/usr/bin/perl -n | |
# thanks to Brian Dowling for an example with security in mind. | |
$TO = ‘root@localhost’; | |
$FROM = $TO; | |
s/^<\d{1,2}>//; | |
open(MAIL, “|/usr/sbin/sendmail -t”); |
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 MyNewerRegexIterator extends RegexIterator { | |
public function accept() { | |
$current = $this->current(); | |
if (! isset($current->item)) { | |
return false; | |
} | |
if (preg_match($this->getRegex(), $current->item)) { |
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 Service_Controller_Action_Helper_RestContextSwitch extends Zend_Controller_Action_Helper_ContextSwitch | |
{ | |
public function getActionContexts($action = null) | |
{ | |
// All actions point back to the global action, or return the complete list of actions | |
return parent::getActionContexts($action ? 'global' : null); | |
} |
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
backend default { | |
.host = "127.0.0.1"; | |
.port = "80"; | |
} | |
// Intialization | |
C{ | |
#include "/usr/src/wurfl/wurfl.h" | |
int is_mobile; | |
}C |
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
#include <avr/interrupt.h> | |
#include <avr/io.h> | |
#define INIT_TIMER_COUNT 100 | |
#define RESET_TIMER2 TCNT2 = INIT_TIMER_COUNT | |
// These are the digits from 0 to 9, with 7 segments | |
byte ssd[10][7] = { | |
{ 1,1,1,1,1,1,0 }, | |
{ 0,1,1,0,0,0,0 }, |
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
MAKEDEPEND=makedepend | |
# Since our sources are nothing more than our objects, which the .o changed to .c, we use this rule: | |
SRCS=$(OBJS:.o=.c) | |
depend: | |
$(MAKEDEPEND) -Y $(SRCS) |
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
Index: stomp.c | |
=================================================================== | |
--- stomp.c (revision 317407) | |
+++ stomp.c (working copy) | |
@@ -473,7 +473,7 @@ | |
while (1) { | |
char *p = NULL; | |
length = stomp_read_line(stomp, &p); | |
- | |
+ |
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 | |
/* | |
* Example 1: Using iteratorAggregate | |
*/ | |
// Simple class that represents our chapter | |
class Chapter { | |
protected $_title; | |
protected $_content; |
OlderNewer