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 file = 'path/to/a/file', | |
stats = fs.statSync(file); | |
var bufferSize = 4 * 1024 * 1024; | |
options = { | |
from: 0, | |
to: bufferSize, | |
bufferSize: bufferSize |
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
diff --git a/classes/kohana/view.php b/classes/kohana/view.php | |
index 17b6fb5..7bffe36 100644 | |
--- a/classes/kohana/view.php | |
+++ b/classes/kohana/view.php | |
@@ -130,6 +130,13 @@ class Kohana_View { | |
{ | |
$this->set_filename($file); | |
} | |
+ else | |
+ { |
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
$directory = rtrim($directory, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; | |
if ($paths === NULL) | |
{ | |
$paths = Kohana::paths(); | |
} | |
$found = array(); | |
foreach ($paths as $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
DB::select() | |
->join('table', 'type') | |
->on('column1', 'operator', 'column2'); |
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
DB::select(array('*', 'rank' => DB::expr('ts_rank_cd(fulltext_tsvector, to_tsquery(\'kohana or something\')))'))) | |
->from('page') | |
->where(DB::expr('to_tsquery(\'kohana or something\')::tsquery'), '@@', DB::expr('fulltext_tsvector::tsvector')); |
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
/** | |
* Returns a list containing items in need of deleteing, and item's in need of adding. | |
* | |
* list($adding, $deleting) = arr::diff($source, $current); | |
* | |
* @param array The new array. | |
* @param array The existing array. | |
* @returns array | |
*/ | |
public static function diff(array $source, array $current) |
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
public static function merge(array $array1, array $_) | |
{ | |
$result = array(); | |
foreach (func_get_args() as $array) | |
{ | |
$i = 0; | |
foreach ($array as $key => $value) | |
{ |
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 | |
if (isset($_POST['account']) AND ! empty($_POST['account'])) | |
{ | |
header('Content-Type: application/xml; charset=ISO-8859-1'); | |
print_r load('http://twitter.com/users/show/'.$_POST['account'].'xml'); | |
} | |
else | |
{ | |
print 'Invalid input data.'; |
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 a recursive array of every model | |
$models = new RecursiveArrayIterator(Kohana::list_files('classes/model')); | |
// Loop through each model recursively | |
foreach (new RecursiveIteratorIterator($models) as $model => $path) | |
{ | |
// Clean up the model name, and make it relative to the model folder | |
$model = trim(str_replace(array('classes/model', EXT), '', $model), DIRECTORY_SEPARATOR); | |
// Replace the directory seperators with underscores |
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
public static function memory($bytes, $places = 2) | |
{ | |
static $suffexes = array( | |
'B', 'KB', 'MB', 'GB', 'TB', 'PB' | |
); | |
$i = 0; | |
while ($bytes > 10) | |
{ |
NewerOlder