Skip to content

Instantly share code, notes, and snippets.

View housni's full-sized avatar

Housni Yakoob housni

View GitHub Profile
<?php
/* config/bootstrap/session.php */
use lithium\storage\Session;
$name = basename(LITHIUM_APP_PATH);
Session::config(array(
// 'cookie' => array('adapter' => 'Cookie', 'name' => $name),
'default' => array('adapter' => 'Php', 'session.name' => $name)
));
@housni
housni / index.html.php
Created February 12, 2012 16:43
Ltihium view
<?php $this->title('Listing Departments'); ?>
<h2>Listing Departments</h2>
<?php if (empty($departments)): ?>
<p>Sorry, there are no Departments to display.</p>
<?php else: ?>
<table>
<tr>
<th style="width: 75%;">Title</th>
<th colspan="3">Actions</th>
</tr>
Base model
<?php
namespace app\extensions\data;
class Model extends \lithium\data\Model {
public static function __init() {
$self = static::_object();
static::config();
@housni
housni / gist:1818766
Created February 13, 2012 18:14
How do I display model a property in a view?
//controllers/AdminsController.php
<?php
class AdminsController extends \lithium\action\Controller {
public function search() {
if (form submitted) {
//prepare the url and redirect to same method
//so that we have a _GET based search URL
} else {
<?php
//extensions/data/Model.php
public static function __init() {
static::_isBase(__CLASS__, true);
parent::__init();
//static::all(); //doesn't work
#$self = static::_object();
Model:
<?php
class ZipCodes extends \app\extensions\data\Model {
protected $_meta = array(
'key' => 'zip_code_id',
'title' => 'state_name'
);
protected $_schema = array(
[{"name":"Bears","color":"Blue","position":{"x":177,"y":85},"modelclass":"Bear","increment":false,"timestamp":false,"softdelete":false,"column":[{"colid":"c217","name":"id","type":"increments","length":"0","order":0,"defaultvalue":"","enumvalue":""},{"colid":"c218","name":"name","type":"string","length":"200","order":1,"defaultvalue":"","enumvalue":""},{"colid":"c219","name":"danger_level","type":"string","length":"200","order":2,"defaultvalue":"","enumvalue":""}],"relation":[{"extramethods":"","foreignkeys":"","name":"fish","relatedmodel":"Fish","relationtype":"hasOne","usenamespace":""},{"extramethods":"","foreignkeys":"","name":"trees","relatedmodel":"Trees","relationtype":"hasMany","usenamespace":""},{"extramethods":"","foreignkeys":"bear_id, picnic_id","name":"picnics","relatedmodel":"Picnics","relationtype":"belongsToMany","usenamespace":""}],"seeding":[]},{"name":"Fish","color":"Yellow","position":{"x":1063,"y":14},"modelclass":"Fish","increment":false,"timestamp":false,"softdelete":false,"column":[{"c
# sudo apt-get install make build-essential ccache g++ libgif-dev libjpeg62-dev libfreetype6-dev libpng12-dev libgif-dev
# cd /tmp/alfrescoinstall
# curl -# -O http://www.swftools.org/swftools-2013-04-09-1007.tar.gz
# tar xf swftools*.tar.gz
# cd "$(find . -type d -name "swftools*")"
# ./configure
# sudo make && sudo make install
Installing build tools and libraries needed to compile swftools. Fetching packages...
debconf: unable to initialize frontend: Dialog
version: '2'
services:
mariadb:
env_file:
- ./mariadb/dev/passwords.env
# cat ./mariadb/dev/passwords.env
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=database_name_here
AWSTemplateFormatVersion: '2010-09-09'
Resources:
MyLambdaFunction:
Type: AWS::Lambda::Function
.
.
.