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 MyInt { | |
private $value = 0; | |
public function __construct($value) { | |
$this->value = $value; | |
} | |
} | |
$a = new MyInt(10); |
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 Route { | |
private static $routes = array(); | |
public static function set($regex, $defaults) { | |
self::$routes[] = new Route($regex, $defaults); | |
} | |
public static function match($uri) { |
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 ps ( $A ) { | |
$used = array(); | |
$index = 0; | |
$count = count($A); | |
for($i = 0; $i < $count; $i++) { | |
if (!isset($used[$A[$i]])) { | |
$index = $i; | |
$used[$A[$i]] = true; | |
} |
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 equi ( $A ) { | |
$count = count($A); | |
$total = array_sum($A); | |
$right = $total; | |
$left = 0; | |
for($i = 0; $i < $count; $i++) { | |
$right -= $A[$i]; | |
if ($left == $right) |
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
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
static NSString *CellIdentifier = @"Cell"; | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; | |
UILabel *label; | |
UITextField *textField; | |
if (cell == nil) { | |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; |
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 DBObject { | |
public function getManyMany($class,$where = false,$options = array()){ | |
$table = static::_table(); | |
$join = $class::_table(); | |
if (strnatcmp($table, $join)) | |
$join_table = sprintf('%s_%s', $join, $table); | |
else | |
$join_table = sprintf('%s_%s', $table, $join); | |