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
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(100); |
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
/* | |
* File: bst.js | |
* | |
* A pure JavaScript implementation of a binary search tree. | |
* | |
*/ | |
/* | |
* Class: BST | |
* |
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
# skipp it if you wont change mirror of repository | |
curl https://raw.github.com/gist/1588091/8b7b7a203074231f3dc75bdee48b3017078fb621/CentOS-Base.repo -o /etc/yum.repos.d/CentOS-Base.repo | |
curl https://raw.github.com/gist/1588091/2e5ab750cd0603dd7210ea7a999d15f9aadae711/epel.repo -o /etc/yum.repos.d/epel.repo |
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 | |
/* | |
cakephp 1.2 database configuration for different environments | |
@author AgBorkowski | |
@link http://blog.aeonmedia.eu/2013/02/good-way-to-change-in-easy-way-application-environment | |
*/ | |
class DATABASE_CONFIG { | |
public $default = 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
public $validates = [ | |
'email_id' => [ | |
[ | |
'notEmpty', | |
'email', | |
'required' => true, | |
'message' => 'Enter a valid email', | |
'last' => 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
<?php | |
//route.php | |
/** | |
* Lithium REST routes | |
* Support: | |
* - Angular, NgResource, $http | |
* - ExtJs (Media.php should be included) | |
* | |
* @author AgBorkowski <[email protected]> http://blog.aeonmedia.eu | |
* @see http://book.cakephp.org/view/1239/The-Simple-Setup |
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 | |
//config/bootstrap/cache.php | |
use lithium\storage\Cache; | |
Cache::config(array( | |
'local' => array( | |
'adapter' => 'Apc' | |
), |
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 | |
// somewhere in config/bootstrap | |
Dispatcher::config(array('rules' => array( | |
'admin' => array( | |
'action' => 'admin_{:action}' | |
) | |
))); | |
// app/classes/PostsController.php |
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 Base extends lithium\data\Model { | |
public function save($entity, $data = null, array $options = array()) { | |
if ($data) { | |
$entity->set($data); | |
} | |
if (!$entity->exists()) { | |
$entity->created = new MongoDate(); |
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 | |
if (!Environment::is('production')) { | |
// Attach to the `Connections` adapters after dispatch. | |
Filters::apply('\lithium\action\Dispatcher', '_callable', function($self, $params, $chain) { | |
/** | |
* Loop over all defined `Connections` adapters and tack in our | |
* filter on the `_execute` method. | |
*/ | |
foreach (Connections::get() as $connection) { |