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 | |
function textSize($size, $angle, $font, $text) { | |
$f = imagettfbbox($size, $angle, $font, $text); | |
return array( | |
'height' => $f[1] - $f[5], | |
'width' => $f[4] - $f[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
<?php | |
$provider = new stdClass(); | |
echo '<pre>'; | |
echo 'First: ' . spl_object_hash($provider) . PHP_EOL; | |
function testProvider(stdClass $provider) { | |
$provider->name = 'Blaine'; |
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 | |
$alpha = array_map('chr', range(97, 122)); // a-z | |
$_alpha = array_map('chr', range(65, 90)); // A-Z | |
print_r($alpha); | |
print_r($_alpha); |
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 | |
$response = new stdClass(); | |
echo '1): ' . spl_object_hash($response) . PHP_EOL; // 0000000021e89fcd00000000e93b17ba | |
call_user_func_array(function($response) { | |
$response = new stdClass(); | |
echo '2): ' . spl_object_hash($response) . PHP_EOL; // 0000000021e89fcf00000000e93b17ba | |
}, array($response)); |
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 | |
Route::filter('after', function($response) | |
{ | |
$params = \Laravel\Request::$route->parameters; | |
// The 'type' is the last param | |
// example: /product/(:num).(:any) | |
$type = array_pop($params); | |
if($type == 'json') { | |
$res = Response::json($response->content->data); |
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 | |
interface iGame { | |
public function start(); | |
public function end(); | |
public function move(); | |
} | |
class tictactoe implements iGame { | |
public function start() { |
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 | |
use Behat\Behat\Context\ClosuredContextInterface, | |
Behat\Behat\Context\TranslatedContextInterface, | |
Behat\Behat\Context\BehatContext, | |
Behat\Behat\Exception\PendingException; | |
use Behat\Gherkin\Node\PyStringNode, | |
Behat\Gherkin\Node\TableNode; | |
use Behat\Mink\Driver\GoutteDriver, | |
Behat\Mink\Driver\Selenium2Driver, |
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 | |
use lithium\analysis\Logger; | |
// Setup firephp in one file | |
Logger::config(array( | |
'firebug' => array( | |
'adapter' => 'FirePhp', | |
), | |
)); | |
// Setup file adapter in another place | |
Logger::config(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 | |
namespace app\tests\cases\controllers; | |
class AssertTest extends \lithium\test\Unit { | |
public function testSomething() { | |
$this->assert(true, 'this is true'); // true | |
$this->assertCount(10, array(1)); // false | |
} |
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
# Clear the cache | |
alias .hb.remote.cc="ssh mdxdev '.hb.cc'" | |
function .hb.cc() { | |
# Directory | |
.hb | |
# CSS | |
if [ $(ls app/webroot/css/compiled/ | wc -l) -gt 0 ] | |
then | |
echo Ridding CSS |
OlderNewer