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 | |
/** | |
* Gemstone::framework app/lib/utils/inflector.lib.php | |
* | |
* Library to provide a framework for various inflections. | |
* | |
* @author Pavel Lisa <[email protected]> | |
* @copyright 2010 Gemstone Webdesign | |
* @package framework | |
* @subpackage library |
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 | |
/** | |
* @author Pavel Lisa <[email protected]> | |
* | |
* Requires PHP 5.3+ | |
*/ | |
// get a singleton instance of ActiveRecord\Table | |
// -> there is one AR\Table instance for each table, |
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
#include <string> | |
template <class T> | |
struct Comparer | |
{ | |
Comparer(void){} | |
~Comparer(){} | |
// const & - not modifying compared items and not copying them | |
int operator () (const T & a, const T & b) const |
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
#include <memory> | |
template <class Type, class Allocator = std::allocator<Type> > | |
class RB_Tree | |
{ | |
public: | |
RB_Tree (void) {} | |
~RB_Tree () {} | |
typedef Allocator allocator_type; |
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 | |
include 'test/test1.php'; | |
echo 'Entry file executed! '; | |
?> |
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
#ifdef __cplusplus | |
#include <iostream> | |
int main(int argc, const char **argv) { | |
for (unsigned int i = 0; i < 5; i++) { | |
std::cout << "Hello!" << std::endl; | |
} | |
} | |
#endif |
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 | |
function array_merge_derivation (array $base, array $derived) | |
{ | |
$merged = []; | |
foreach ($base as $base_key => $base_value) { | |
$merged[$base_key] = $base_value; | |
if (isset($derived[$base_key])) { | |
if (\is_array($base_value)) { | |
$merged[$base_key] = array_merge_derivation($base[$base_key], $derived[$base_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
require "continuation" | |
$a = 1 | |
def test | |
$a = callcc do |cc| | |
$b = cc | |
puts $a | |
3 | |
end | |
end |
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 | |
function array_group_by (array $array, callable $mapping) | |
{ | |
$buckets = []; | |
foreach ($array as $item) { | |
$key = $mapping($item); | |
if (!isset($buckets[$key])) { | |
$buckets[$key] = [$item]; | |
} else { | |
$buckets[$key][] = $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 | |
class ClassObject | |
{ | |
const METHOD_NEW = 'new'; | |
private static $classObjectInstances = []; | |
private $className; | |
public static function get ($className) |
OlderNewer