This file contains 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
<div> | |
<!--nocache--> | |
<?php echo $this->Session->read('Auth.User.username'); ?> | |
<!--/nocache--> | |
</div> |
This file contains 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
$this->request->data('Post.title', 'New post') | |
->data('Comment.1.author', 'Mark'); |
This file contains 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
<?php | |
class Post extends AppModel { | |
public $findMethods = array( | |
'latest' => true, | |
); | |
protected function _findLatest($state, $query, $results = array()) { | |
if ($state == 'before') { | |
// extend | |
// $query = Set::merge($query, array('conditions' => array())); | |
return $query; |
This file contains 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
<?php | |
class Post extends AppModel { | |
public $validate = array( | |
'title' => array( | |
'between' => array( | |
'rule' => array('between', 10, 100), | |
'message' => 'The title must have between %d to %d characters', | |
), | |
), | |
); |
This file contains 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
# .git/config | |
[remote "origin"] | |
fetch = +refs/heads/*:refs/remotes/origin/* | |
url = /var/dev/repos/tipshare.git | |
url = git@github.com:MontBlanc-Sucks/tipshare.git |
This file contains 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
tmp/* | |
Config/database.php | |
app/tmp/* | |
app/Config/database.php | |
!empty |
This file contains 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
#!/bin/sh | |
cd /path/to/your_app_root | |
# ls | |
# cake app ... | |
find ./*/tmp/cache -type f -name '*' -exec rm {} \; |
This file contains 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
public function beforeFilter() { | |
parent::beforeFilter(); | |
$this->_setLocale(); | |
} | |
protected function _setLocale() { | |
if (isset($this->request->query['hl'])) { | |
CakeSession::write('App.lang', $this->request->query['hl']); // you can use any key instead of 'App.lang' | |
} | |
if (CakeSession::read('App.lang')) { |
This file contains 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
public function beforeFilter() { | |
$this->disableDebugKitIfisAjax(); | |
} | |
protected function disableDebugKitIfisAjax() { | |
if ($this->request->isAjax()) { | |
Configure::write('debug', 0); | |
$this->Components->disable('Toolbar'); | |
} | |
} |
This file contains 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
Number.prototype.fizzBuzz = function() { | |
return (this % 3 === 0 ? "Fizz" : "") + (this % 5 === 0 ? "Buzz" : "") || this.toString(); | |
} | |
// main | |
for (var i=1; i<=100; i++) { | |
console.log( i.fizzBuzz() ); | |
} |