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 Collection | |
{ | |
/** | |
* Gets an item from the collection | |
* | |
* @param $item | |
* @return string|null | |
*/ | |
public function get($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
// Step 1: include jQuery | |
var jq = document.createElement('script'); | |
jq.src = "//code.jquery.com/jquery-latest.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
// ... give time for script to load, then type. | |
jQuery.noConflict(); | |
// Step 2: create a textarea | |
jQuery('#console').after('<textarea id="filenames"></textarea>'); |
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 MyService { | |
private $finderFactory; | |
public function __construct(callable $finderFactory) | |
{ | |
$this->finderFactory = $finderFactory; | |
} | |
public function findStuff() | |
{ |
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 FailTest extends \PHPUnit_Framework_TestCase | |
{ | |
public function testfail() | |
{ | |
fail(); | |
$this->assertTrue(true); | |
} | |
} |
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
package main | |
import "fmt" | |
type IPAddr [4]byte | |
func (i IPAddr) String() string { | |
return string(i[0]) // Returns an empty string | |
return fmt.Sprintf("%v.%v.%v.%v", i[0], i[1], i[2], i[3]) // Only way to cast byte to string is through Sprintf | |
} |
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
[vagrant@luceo-ocb vagrant]$ php -v | |
PHP 5.4.41 (cli) (built: May 14 2015 23:37:34) | |
Copyright (c) 1997-2014 The PHP Group | |
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies |
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 | |
/** | |
* Company | |
* | |
* This class has been auto-generated by the Doctrine ORM Framework | |
* | |
* @package winston | |
* @subpackage model | |
* @author Clement Herreman <clement@activcompany.fr> |
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 | |
$badDate = '2010-13-03'; | |
$date = DateTime::createFromFormat('Y-m-d', $badDate); | |
var_dump($date); | |
/* | |
object(DateTime)#284 (3) { | |
["date"]=> | |
string(19) "2011-01-03 10:01:20" |
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 Person | |
{ | |
private $phone; | |
private $name; | |
public function __construct($name, $phone) | |
{ | |
var_dump($name); | |
var_dump($phone); |
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 DocumentIdentificationForm extends DocumentForm | |
{ | |
protected function doUpdateObject($values) | |
{ | |
parent::doUpdateObject($values); | |
if ($values['author_id']) | |
$this->getObject()->setStatusId(Doctrine_Core::getTable('Status')->getIdentifiedStatus()); | |
else |
OlderNewer