This file contains hidden or 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 myClass { | |
protected $creator; | |
public function set(callable $creator) | |
{ | |
$this->creator = $creator | |
} |
This file contains hidden or 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 Project\Log\tests\units; | |
use \mageekguy\atoum; | |
class Logger extends atoum\test | |
{ | |
public function testStdout() |
This file contains hidden or 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
// The following code doesn't work and makes your app crashes | |
// Because you MUST NOT use deferred code that access to calendar | |
Ti.Calendar.requestEventsAuthorization(function(e) { | |
Ti.API.info('Authorizations success : ' + e.success); | |
if (e.success) { | |
new Promise(function (resolve) { | |
Ti.API.info('A'); | |
var cal = Ti.Calendar.getDefaultCalendar(); | |
Ti.API.info('A cal id' + cal.id); | |
resolve(cal); |
This file contains hidden or 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 | |
list($useless, $useless, $uesless, $code) = explode('/', $base); |
This file contains hidden or 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
// next two from http://stackoverflow.com/a/5624139/292947 | |
function componentToHex(c) { | |
var hex = c.toString(16); | |
return hex.length == 1 ? "0" + hex : hex; | |
} | |
function rgbToHex(r, g, b) { | |
return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b); | |
} |
This file contains hidden or 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
global NMEs = []; | |
global ID = 0; | |
global FORCE = 1; | |
var enemies = getEnemies(); | |
for (var nme in enemies) { | |
debug(nme + ' ' + getName(nme) + ' ' + getForce(nme)); |
This file contains hidden or 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
// WTF On iOS for horizontal positions (iPad on a table) there are some bugs : in portrait mode e.source.isPortrait = false, Ti.Gesture.isPortrait = false and Ti.Gesture.orientation = 0 or 5 (even in portrait or landscape) !!! | |
// so take the old fashioned screen dimensions | |
Ti.Gesture.addEventListener('orientationchange', function (e) { | |
Alloy.Globals.isPortrait = (Ti.Platform.displayCaps.platformHeight > Ti.Platform.displayCaps.platformWidth); | |
}); |
This file contains hidden or 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
namespace Application\Controller { | |
use Sohoa\Framework\Kit; | |
class Main extends Kit | |
{ | |
public function indexAction() | |
{ | |
$this->customKit->print(); |
This file contains hidden or 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 Application\Controller { | |
use Sohoa\Framework\Kit; | |
class Main extends Kit { | |
public function indexAction() { | |
This file contains hidden or 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 | |
$this->assert | |
->if($inc = function (&$i) { $i++; return $i}) | |
->and($i=0) | |
->then('test the inc') | |
->number($inc($i)) | |
->isEqualTo(1) | |
->then('and test it with same context') | |
->number($inc($i)) |
NewerOlder