Skip to content

Instantly share code, notes, and snippets.

View Narven's full-sized avatar
👾
Walking to the fridge...

Pedro Luz Narven

👾
Walking to the fridge...
View GitHub Profile
@Narven
Narven / CDbCriteria_Like_Conditions
Last active December 16, 2015 09:59 — forked from jamband/sample.php
CDbCriteria Examples
<?php
/* SELECT * FROM `hoge` `t`
---------------------------------------------------*/
$c1 = new CDbCriteria();
$m1 = Hoge::model()->findAll($c1);
/* SELECT * FROM `hoge` `t`
----------------------------------------------------*/
<?php
// first approach
...
$criteria = new CDbCriteria;
$criteria->compare("price", 1);
$posts = Post::model()->find($criteria);
...
// second approach
...
/**
* Git Pull
*
* @author Adam Patterson
* http://www.adampatterson.ca/blog/2011/10/diy-simple-staging-server/
*
* Use: echo pull();
*/
function pull ( )
<?php die('This file is not really here!');
/**
* ------------- DO NOT UPLOAD THIS FILE TO LIVE SERVER ---------------------
*
* Implements code completion for CodeIgniter in phpStorm
* phpStorm indexes all class constructs, so if this file is in the project it will be loaded.
* -------------------------------------------------------------------
* Drop the following file into a CI project in phpStorm
* You can put it in the project root and phpStorm will load it.

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
@Narven
Narven / _form.twig
Created November 26, 2013 01:31 — forked from jamband/_form.twig
<div class="form">
{% set form = this.beginWidget('CActiveForm', {
'id': 'hoge-form',
'enableAjaxValidation': false,
}) %}
<p class="note">Fields with <span class="required">*</span> are required.</p>
{{ form.errorSummary(model) }}
@Narven
Narven / main.php
Created November 26, 2013 21:36 — forked from jamband/main.php
<?php
return array(
'components' => array(
...
'viewRenderer' => array(
'class' => 'ext.ETwigViewRenderer',
'globals' => array(
'Yii' => 'Yii',
'Captcha' => 'CCaptcha',
),
Example 5: Generating dropdownlist with option groups.
from http://www.yiiframework.com/wiki/48/by-example-chtml/#hh4
If you need to generate dropdownlist using both optgroup and option tags use the following code.
<div class="cars-select">
<?php echo CHtml::dropDownList('Cars', 'car_id', array(
'Mazda'=>array(
'mazda-rx7'=>'RX7',
'mazda-rx5'=>'RX5',
<?php
/**
* Controller is the customized base controller class.
* All controller classes for this application should extend from this base class.
*/
class RestController extends CController
{
/**
* @var string the default layout for the controller view. Defaults to '//layouts/column1',
* meaning using a single column layout. See 'protected/views/layouts/column1.php'.
#define DEBUG_CONSOLE
#define DEBUG_LEVEL_LOG
#define DEBUG_LEVEL_WARN
#define DEBUG_LEVEL_ERROR
#if (UNITY_EDITOR || DEVELOPMENT_BUILD)
#define DEBUG
#endif
#if (UNITY_IOS || UNITY_ANDROID)