This file contains hidden or 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
| var cacheCreator = function() { | |
| var memory_content = {}; | |
| return function(key, value) { | |
| var operator = (value === undefined) ? 'get' : 'set'; | |
| if(operator == 'set') { | |
| memory_content[key] = value; | |
| } | |
| return memory_content[key]; | |
| }; |
This file contains hidden or 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
| python -c " | |
| import sys | |
| sys.path = sys.path[1:] | |
| import django | |
| print(django.__path__)" |
This file contains hidden or 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
| def makebold(fn): | |
| def wrapped(): | |
| return "<b>%s</b>" % fn() | |
| return wrapped | |
| def makeitalic(fn): | |
| def cover(): | |
| return "<i>%s</i>" %fn() | |
| return cover |
This file contains hidden or 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
| // schedule update in one second | |
| function updateLater() { | |
| // save the timeoutId for canceling | |
| timeoutId = $timeout(function() { | |
| updateTime(); // update DOM | |
| updateLater(); // schedule another update | |
| }, 1000); | |
| } |
This file contains hidden or 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
| // from: http://danpolant.com/want-to-run-xdebug-mamp-is-the-easiest-way/ | |
| // in /Applications/MAMP/conf/php5.x/php.ini | |
| [xdebug] | |
| zend_extension="/Applications/MAMP/bin/php5.2/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so" | |
| xdebug.remote_enable=1 | |
| xdebug.remote_host=localhost | |
| xdebug.remote_port=9000 | |
| xdebug.remote_handler=dbgp |
This file contains hidden or 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
| class CourseController extends BaseController { | |
| protected $_courseLinks; | |
| public function __construct($params = NULL) { | |
| parent::__construct($params); | |
| $this->_courseLinks = new CourseLinks($this); | |
| } | |
| public function trial() { | |
| ... |
This file contains hidden or 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
| if(NULL == "") { | |
| DU::show('NULL == "" is true'); | |
| } else { | |
| DU::show('NULL == "" is false'); | |
| } | |
| if(NULL == array()) { | |
| DU::show('NULL == array() is true'); | |
| } else { | |
| DU::show('NULL == array() is false'); |