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 | |
/*********************************************************************** | |
UPDATE: See my improved example: https://gist.github.com/mbrowne/5047982 | |
************************************************************************/ | |
ini_set('display_errors', 1); | |
trait AssignableToRole | |
{ |
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 | |
//SEE ALSO: https://gist.github.com/mbrowne/5562643 (works in PHP 5.3 too) | |
//and related discussion: https://groups.google.com/d/msg/object-composition/g4BMSdluuC8/yPR3-a1b2sMJ | |
ini_set('display_errors', 1); | |
trait AssignableToRole | |
{ | |
protected $roles = array(); | |
protected $methods = array(); |
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 Test extends CI_Controller | |
{ | |
public function deploy_test() { | |
$connection = ssh2_connect("123.45.67.890", 23); | |
if(!$connection) { | |
echo json_encode('Connection failed'); | |
} |
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 FreeResponseQuizContext | |
{ | |
protected IEnumerable<Question> questions; | |
FreeResponseQuizContext(Student student, QuizTemplate quizTemplate) { | |
IEnumerable<QuestionTemplate> questionTemplates = quizTemplate.getQuestionTemplates(); | |
QuestionGenerator = questionTemplates; | |
AnswerCalculator = questionTemplates; | |
Student = student; | |
} |
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
.box {padding:10px;} | |
.box, .stack-item:first-child .box {border:1px solid #ccc;} | |
.stack-item .box {border-top:none} | |
.stack {margin:0;padding:0;} | |
ul.stack {list-style:none;} | |
/*Note: if setting a min-height for items, set it on .stack-item .box, not on .stack-item, | |
otherwise .box won't expand to the full height*/ | |
.stack-item .box {height:100%; | |
-moz-box-sizing: border-box; -ms-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box; |
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 | |
namespace DomainObjects; | |
class Account | |
{ | |
protected $balance = 0; | |
function __construct($initialBalance) { | |
$this->balance = $initialBalance; | |
} |
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
/* Put a standard gutter on these common elements, as well as any element with the std-gutter class. | |
This makes it possible to have a standard gutter compatible with IE<=7 without needing to wrap every | |
grid cell with <div class="cell"> (as is done in the Cascade Framework examples) | |
*/ | |
.std-gutter, .panel, .media, h1, h2, h3, h4, h5, h6, dl, p, blockquote, table, address, pre, figure {margin:15px;} | |
/* since we're applying a standard margin, list-style-position:inside is needed to keep lists | |
in alignment with everything else */ | |
ul, ol {list-style-position:inside;} | |
ul {margin:0 0 9px 2.4em} | |
ol {margin:0 0 9px 2em} |
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 Student | |
{ | |
protected $name; | |
/** | |
* social security number | |
* @var string **/ | |
protected $ssn; | |
protected $major; |
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
.grid-row, .col {width:100%;} | |
/* clearfix (http://nicolasgallagher.com/micro-clearfix-hack) */ | |
.grid-row:before, .grid-row:after { | |
content:" "; display:table; | |
} | |
.grid-row:after {clear:both;} | |
/* for IE<=7 */ | |
.grid-row {*zoom: 1;} |
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 Test | |
{ | |
protected $foo; | |
function __construct($foo) { | |
$this->foo = $foo; | |
} | |
} | |
$str = 'O:4:"Test":1:{s:6:"'."\0".'*'."\0".'foo";s:3:"bar";}'; | |
$obj = unserialize($str); | |
var_dump($obj); |
OlderNewer