Skip to content

Instantly share code, notes, and snippets.

View lesschar's full-sized avatar
🎯
Focusing

lesschar

🎯
Focusing
View GitHub Profile

Additional configurations for PhpStorm to develop with Yii framework

Autocomplete Yii::app() components

Open framework/yii.php file, override app() static method as follow:

<?php
class Yii extends YiiBase
{
	/**
 * @static
// A module that can be mixed in to *any object* in order to provide it with
// custom events. You may bind with `on` or remove with `off` callback
// functions to an event; `trigger`-ing an event fires all callbacks in
// succession.
//
// var object = {};
// _.extend(object, Backbone.Events);
// object.on('expand', function(){ alert('expanded'); });
// object.trigger('expand');
@lesschar
lesschar / _vimrc
Last active August 29, 2015 14:06
" =============================================================================
" << 判断操作系统是 Windows 还是 Linux 和判断是终端还是 Gvim >>
" =============================================================================
" -----------------------------------------------------------------------------
" < 判断操作系统是否是 Windows 还是 Linux >
" -----------------------------------------------------------------------------
let g:iswindows = 0
let g:islinux = 0
if(has("win32") || has("win64") || has("win95") || has("win16"))
@lesschar
lesschar / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

##Main features

  • Support All modern browsers and native platforms
  • Scene management (workflow)
  • Transitions between scenes
  • Sprites and Sprite Sheets
  • Effects: Lens, Ripple, Waves, Liquid, etc.
  • Actions (behaviours):
    • Trasformation Actions: Move, Rotate, Scale, Fade, Tint, etc.
  • Composable actions: Sequence, Spawn, Repeat, Reverse
@lesschar
lesschar / CCClass.js
Created September 19, 2014 08:46
Generate ramdom int
id : (0|(Math.random()*998)),
---------------------|----------------------------------------------
<Leader>f{char} | Find {char} to the right. See |f|.
<Leader>F{char} | Find {char} to the left. See |F|.
<Leader>t{char} | Till before the {char} to the right. See |t|.
<Leader>T{char} | Till after the {char} to the left. See |T|.
<Leader>w | Beginning of word forward. See |w|.
<Leader>W | Beginning of WORD forward. See |W|.
<Leader>b | Beginning of word backward. See |b|.
<Leader>B | Beginning of WORD backward. See |B|.
<Leader>e | End of word forward. See |e|.
function __clone()
{
// 强制复制一份this->object, 否则仍然指向同一个对象
$this->object1 = clone $this->object1;
}
<?php
public function __set($name, $value)
{
$setter = 'set' . $name;
if (method_exists($this, $setter)) {
// set property
$this->$setter($value);
return;
} elseif (strncmp($name, 'on ', 3) === 0) {
@lesschar
lesschar / std.php
Last active August 29, 2015 14:08
something about Closure
<?php
/* Besides the methods listed here, this class also has an __invoke method.
* This is for consistency with other classes that implement calling magic, as this method is not used for calling the function.
* by charles
*/
final class Closure {
/**
* This method exists only to disallow instantiation of the Closure class.
* Objects of this class are created in the fashion described on the anonymous functions page.