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
<?php | |
// CORE/app/models/datasources/json_source.php | |
/** | |
* JSON Source module for CakePHP. | |
* | |
* @package cake | |
*/ | |
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
/** | |
* Get last segment from URL | |
* @note array.filter browser support: IE.9+, Firefox 1.5 + | |
* @return string URL last segment | |
*/ | |
function getLastSegmentFromUrl() { | |
path = window.location.pathname; | |
segments = path.split('/'); | |
//remove empty spaces | |
segments = segments.filter(function(item) { |
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
<?php | |
App::uses('ArticleListsAppModel', 'ArticleLists.Model'); | |
/** | |
* ArticleList Model | |
* | |
* @property ArticleListPost $ArticleListPost | |
*/ | |
class ArticleList extends ArticleListsAppModel { | |
const MASK_ID = 1; |
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
<?php | |
class MyObserver implements SplObserver { | |
public function update(SplSubject $subject) { | |
echo __CLASS__ . ' - ' . $subject->getName(); | |
} | |
} | |
class MySubject implements SplSubject { | |
private $_observers; |
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
<?php | |
/* | |
* Count number of words from the given txt file | |
* @author Antonis Flangofas | |
* @date 18/08/2014 | |
*/ | |
class WordCounter | |
{ | |
const ASC = 2; | |
const DESC = 4; |
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
<?php | |
class FindReplace{ | |
const TOKEN = '&&'; | |
const HYPHEN = '-'; | |
const TARGETDIR = 'modified'; | |
const TEMPLATESDIR = 'templates'; | |
public $data = array(); | |
public $filename; |
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
<?php | |
$obj = new FileFinder($argv[1]); | |
$obj->setFileType(array_slice($argv, 2)); | |
$obj->setExcludingDirectories(array('test1')); | |
$pages = $obj->find(); | |
print_r($pages); | |
class FileFinder |
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
syntax on | |
set number | |
set wrap | |
set laststatus=2 " Always show the statusline | |
set title " Set the title of the window in the terminal to the file | |
set history=500 " History | |
set backup | |
"Followin cmd must be configure with X11 | |
set clipboard+=unnamed " Yank to system clipboard | |
set showcmd " Display an incomplete command in the lower right corner of the Vim window |
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
<?php | |
echo fibonacciCode($argv[1]) . PHP_EOL; | |
/** | |
* This function returns the fibonacci sequence | |
* | |
* @param mixed sequence | |
* @return int total | |
*/ |
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
function convertMiliseconds(miliseconds, format) { | |
var days, hours, minutes, seconds, total_hours, total_minutes, total_seconds; | |
total_seconds = parseInt(Math.floor(miliseconds / 1000)); | |
total_minutes = parseInt(Math.floor(total_seconds / 60)); | |
total_hours = parseInt(Math.floor(total_minutes / 60)); | |
days = parseInt(Math.floor(total_hours / 24)); | |
seconds = parseInt(total_seconds % 60); | |
minutes = parseInt(total_minutes % 60); |