Skip to content

Instantly share code, notes, and snippets.

<?php
class PostsController extends Controller
{
public function actionLike($id)
{
$model = $this->loadModel($id);
$model->views = $model->views + 1;
$model->save();
minetest.register_on_mapgen_init(function(mgparams)
minetest.set_mapgen_params({mgname="singlenode", water_level=-32000})
end)
@cornernote
cornernote / JohnYiiBase.php
Last active August 29, 2015 14:07
Yii Base Extended
<?php
/**
* Include the Yii Framework
*/
require_once(YII_PATH . DS . 'YiiBase.php');
/**
* Yii is a helper class serving common framework functionalities.
*/
class Yii extends YiiBase
@cornernote
cornernote / update.php
Created September 27, 2014 02:16
Auto Git Update
<?php
$runtimePath = '/home/user/app/runtime';
if (!empty($_GET['project'])) {
if (in_array($_GET['project'], array('app'))) {
file_put_contents($runtimePath . '/update-' . $_GET['project'], '');
}
}
add_filter('template_redirect', 'my_404_override');
add_filter('the_content', 'my_content_override');
function my_404_override()
{
global $wp_query;
if (true) {
status_header(200);
$wp_query->is_404 = false;
<?php
if(isset($_GET['event'])) {
// Does the model have this attribute? If not raise an error
$this->event = $_GET['event'];
$this->id = $_GET['id'];
$this->relayer = $_GET['relayer'];
$this->relayer_phone = $_GET['relayer_phone'];
$this->phone = $_GET['phone'];
$this->text = $_GET['text'];
$this->time = $_GET['time'];
gpg --list-keys
/root/.gnupg/pubring.gpg
------------------------
pub 1024D/2D15CE4F 2014-01-28
uid root <root@dom.ain>
sub 2048g/0B8C6ED2 2014-01-28
/**
* AssetManager
*
* @author Brett O'Donnell <cornernote@gmail.com>
* @copyright 2013 Mr PHP
* @license BSD-3-Clause
*/
class AssetManager extends CAssetManager
{
@cornernote
cornernote / MyModel.php
Created January 13, 2014 06:12
recursive get parents
class MyModel extends CActiveRecord
{
public function relations()
{
return array(
'parent' => array(
self::BELONGS_TO,
'MyModel',
'parent_id',
@cornernote
cornernote / MyModule.php
Created December 26, 2013 15:40
yii bootstrap looking module without yiistrap or booster
/**
* Initializes the audit module.
*/
public function init()
{
parent::init();
// setup paths
Yii::setPathOfAlias('audit', dirname(__FILE__));
$this->setImport(array(