Skip to content

Instantly share code, notes, and snippets.

@rapzo
rapzo / media.php
Created March 19, 2012 19:13 — forked from nateabele/media.php
An example of how to completely reconfigure Lithium's templating engine
<?php
use lithium\net\http\Media;
/**
* This re-maps your template paths so you can have stuff like `pages/users_{username}.php`
* instead of the Lithium default.
*/
Media::type('html', 'text/html', array(
'view' => 'lithium\template\View',
<?php
namespace app\tests\cases\controllers;
use app\tests\mocks\MockArticlesController;
use app\tests\mocks\action\MockControllerRequest as Request; //Mocking the Request
class ArticlesControllerTest extends \lithium\test\Unit {
protected $_controller;
@rapzo
rapzo / Base.php
Last active December 17, 2015 08:59 — forked from nateabele/Base.php
<?php
namespace my_app\models;
use MongoId;
use lithium\data\collection\DocumentSet;
use lithium\data\entity\Document;
use lithium\util\Inflector;
use lithium\core\Libraries;
use lithium\util\Set;
class BaseModel extends \lithium\data\Model {
public function save($entity, $data = null, array $options = []) {
$now = new \MongoDate();
if (!$entity->exists()) {
$entity->created = $now;
}
$entity->updated = $now;
return parent::save($entity, $data, $options);
}
var FormView = Backbone.View.extend({
el: '#form',
events: {
// Fired automatically when a file-type input is detected with a
// non-blank value. You can use this hook to implement a handler that
// will deal with those non-blank file inputs. Returning false will
// disallow standard form submission.
'ajax:aborted:file' : 'ajaxAbortedFile',
@rapzo
rapzo / composer
Created August 19, 2013 16:18
Composer example to use with lithium php framework (lithify.me)
{
"repositories": [{
"type": "package",
"package": {
"name": "unionofrad/lithium/lithium",
"version": "dev-master",
"type": "lithium-library",
"source": {
"url": "https://github.com/UnionOfRAD/lithium",
"type": "git",
{
"name": "http-server",
"preferGlobal": true,
"version": "0.3.0",
"author": "Nodejitsu <[email protected]>",
"description": "a simple zero-configuration command-line http server",
"contributors": [
{
"name": "Marak Squires",
"email": "[email protected]"
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library model;
import 'package:polymer/polymer.dart';
final appModel = new AppModel._();
<?php
namespace app\models;
class BaseModel extends \lithium\data\Model {
public function save($entity, $data = null, array $options = []) {
$now = new DateTime();
if (!$entity->exists()) {
$entity->created = $now;
}
$entity->updated = $now;
<?php
namespace jojo\tests\cases\extensions\util;
use lithium\util\Validator;
class ValidatorTest extends \lithium\test\Unit {
public function setUp() {
}