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 | |
| /** | |
| * Checks if the field is a valid email address according to RFC 2822 | |
| * | |
| * @package repository | |
| * @subpackage rules | |
| */ | |
| class ComplexEmailRule extends ValidationRule { |
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
| # 1.8.7 only (boo fucking hoo) | |
| return key.shuffle!.to_s | |
| key = key.sort_by { rand } | |
| return key.to_s |
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
| class PictureResource(ApiHandler): | |
| def post(self, name, ext): | |
| if not self.check_uploaded_picture(): | |
| return | |
| picture = Picture.find(name, ext) | |
| if not picture: | |
| picture = Picture() |
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
| class ApiHandler(webapp.RequestHandler): | |
| def check_uploaded_picture(self): | |
| if not self.check_api_key(): | |
| self.error_response(401, API_ERROR_UNAUTHORIZED) | |
| return False | |
| if not self.request.get('picture'): | |
| self.error_response(400, API_ERROR_MISSING) | |
| return False |
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
| class Picture(db.Model): | |
| name = db.StringProperty() | |
| ext = db.StringProperty() | |
| mime_type = db.StringProperty() | |
| source = db.BlobProperty() | |
| thumb = db.BlobProperty() | |
| default = db.BlobProperty() | |
| caption = db.StringProperty() | |
| updated_at = db.DateTimeProperty() |
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 | |
| function getRecordWithLocalScope() { | |
| $object = $this->scope->getObject($this->currentQuery); | |
| if (!$object) { | |
| $object = $this->gateway->getObject(); | |
| $this->scope->addObject($object); | |
| } | |
| $record = (isset($object->type)) ? $object->type : $this->currentRecordType; | |
| return new $record($object); |
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
| YAML Config | |
| IdentityDispatcher: | |
| - DefaultBinding: action | |
| MysqlConnection: | |
| - Name: | |
| - Pass: | |
| - Database: default | |
| - Host: localhost |
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
| mv repository/store/mysql repository/services/mysql | |
| mv repository/store/redis repository/services/redis | |
| mv repository/store/memcached repository/services/memcached | |
| mv repository/store/sqlite repository/services/sqlite |
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 | |
| # Autoload Hooks | |
| Using::models("app.domain.subpackage"); | |
| Using::controllers("app.controllers"); | |
| Using::templates("app.templates"); | |
| # Require from package path | |
| Using::classPath("lib.floe.repository"); |
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 | |
| $finder = new Finder("translations"); | |
| // OR | |
| class TranslationsFinder extends Finder {} | |
| $finder = new TranslationsFinder(); |