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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: elasticsearch | |
# Required-Start: $all | |
# Required-Stop: $all | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Starts elasticsearch | |
# Description: Starts elasticsearch using start-stop-daemon | |
### END INIT INFO |
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
// This can go in a custom bootstrap file | |
use lithium\core\Environment; | |
Environment::set('foo.com', array( | |
'something' => array( | |
'filename' => 'foo.yml' | |
) | |
)); |
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
use lithium\storage\Session; | |
Session::config(array( | |
'default' => array( | |
'adapter' => 'Cookie', | |
'strategies' => array( | |
'Encrypt' => array('secret' => 'somesecretstring') | |
) | |
) |
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
Session::config(array( | |
'default' => array( | |
'adapter' => 'Cookie', | |
'strategies' => array( | |
'Hmac' => array( | |
'secret' => '$f00bar$' | |
), | |
'Encrypt' => array( | |
'secret' => '$f00bar$' | |
) |
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 | |
Router::connect('/admin/{:args}', array('admin' => true), array('continue' => true)); | |
Router::connect('/{:locale:en|de|jp}/{:args}', array(), array('continue' => true)); | |
Router::connect('/{:args}.{:type}', array(), array('continue' => 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 | |
$method = array(Connections::get('default'), 'read'); | |
ErrorHandler::apply($method, array(), function($error, $params) { | |
$queryParams = json_encode($params['query']); | |
$msg = "Query error: {$error['message']}"; | |
Logger::warning("{$msg}, data: {$queryParams}"); | |
return new DocumentSet(); |
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
// View | |
<?= $this->form->create(); ?> | |
<?=$this->security->requestToken(); ?> | |
<?=$this->form->field('title'); ?> | |
<?=$this->form->submit('Submit'); ?> | |
<?=$this->form->end(); ?> | |
// Controller | |
public function add() { | |
if ($this->request->data && !RequestToken::check($this->request)) { |
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/access.php | |
Access::config(array( | |
'asset' => array( | |
'adapter' => 'Rules', | |
'allowAny' => true, | |
'default' => array('isPublic', 'isOwner', 'isParticipant'), | |
'user' => function() { return Accounts::current(); }, | |
'rules' => 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 | |
// Make sure you return on redirect, not do this: | |
class PostsController extends Base { | |
public function view($post) { | |
if (!$post) { | |
$this->redirect("Posts::index"); | |
} |
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 | |
// FAT FILTERS == BAD | |
// Try to make filters do one thing, not like this... | |
Dispatcher::applyFilter(run, function($self, $params, $chain) { | |
// Herp | |
// Derp | |
// Herp | |
// Derp |
OlderNewer