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
[alias] | |
st = status | |
br = branch | |
co = checkout | |
unstage = reset HEAD | |
[color] | |
ui = auto |
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 Person | |
{ | |
protected $name = NULL, $surname = NULL; | |
public function __construct($name, $surname) | |
{ | |
$this->name = $name; | |
$this->surname = $surname; | |
} |
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
use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
use Symfony\Component\HttpFoundation\RedirectResponse; | |
class UserController extends Controller | |
{ | |
/** | |
* @extra:Template() | |
*/ | |
public function indexAction() | |
{ |
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/bash | |
# This script copies your publick key to server passed as first argument and makes your life happier. Send me a nice thought. Francesco Levorato | |
if [ $# -ne 1 ]; then | |
echo Usage: $0 username@server | |
exit | |
fi | |
cat ~/.ssh/id_dsa.pub | ssh $@ 'mkdir -p .ssh; cat >> .ssh/authorized_keys; chmod 700 .ssh; chmod 600 .ssh/authorized_keys' |
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 | |
public function testIteratesOverOneElementArraysUsingValues() | |
{ | |
$iterator = new ArrayIterator(array('foo')); | |
foreach ($iterator as $element) { | |
$this->assertEquals('foo', $element); | |
} | |
} | |
public function testIteratesOneTimeOverOneElementArrays() | |
{ |
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 | |
public function testIteratesOverOneElementArrays() | |
{ | |
$iterator = new ArrayIterator(array('foo')); | |
$i = 0; | |
foreach ($iterator as $element) { | |
$this->assertEquals('foo', $element); | |
$i++; | |
} | |
$this->assertEquals(1, $i); |
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 Doctrine_Ticket_DC329_TestCase extends Doctrine_UnitTestCase | |
{ | |
public function prepareTables() | |
{ | |
$this->tables[] = "Ticket_DC329_Document"; | |
$this->tables[] = "Ticket_DC329_DocumentRelation"; | |
parent::prepareTables(); | |
} |
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 | |
$array = array(5, 3, 2, 1, 7); | |
function worse_recursive_ordering($array) { | |
if (count($array) <= 1) { | |
return $array; | |
} | |
// Find minimum | |
$minimum = $array[0]; |
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 | |
$array = array(5, 3, 2, 1, 7); | |
function recursive_ordering($array) { | |
if (count($array) <= 1) { | |
return $array; | |
} | |
// Find minimum | |
$minumum_id = 0; |
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 | |
/** | |
* Carica un prodotto in base al modello. Ispirato da uc_ajax_cart_add_item() | |
* @param unknown_type $model | |
* @return unknown_type | |
*/ | |
function uc_product_load_by_model($model) { | |
$product = db_fetch_object(db_query('SELECT vid, model, list_price, cost, sell_price, weight, weight_units, length, width, height, length_units, pkg_qty, default_qty, unique_hash, ordering, shippable FROM {uc_products} WHERE model = "%s"', $model)); | |
$node = node_load(array('vid' => $product->vid)); | |
uc_product_load($node); |