Example 1:
$math = new Math;
$balance = 12.30;
$deposit = 1.70;
$total = $math->sum($balance, $deposit);
if ($total === 14)
echo 'Ok';
else
echo 'Fail';
<?php | |
/** | |
* Example of usage of the "Respect Framework", that is actually | |
* just using one or more Respect components together. | |
* | |
* Using components in version 0.4.* | |
*/ | |
use Respect\Validation\Validator as v; | |
use Respect\Rest\Router; |
// ==UserScript== | |
// @name Referral: your mom | |
// @namespace yourmom | |
// @description This script changes every utm_source variable in links to 'Your mom'. | |
// @include * | |
// ==/UserScript== | |
var links = document.getElementsByTagName('a'); | |
for(var i=0; i<links.length; i++) { | |
links[i].href = links[i].href.replace(/([&|?])utm_source=(.*)([&|?|^])/,"$1utm_source=Your+mom$3"); |
#!/usr/bin/env python3 | |
import argparse | |
import sys | |
def tokenize(source): | |
return list(source) | |
def parse(tokens): | |
ast = [] | |
stack = [ast] |
<?php | |
use FooBar\Test\Mock; | |
// In the sample below, $mock expects the method "sayHelloTo" to be called one time | |
// with the parameter $name equals "Alexandre" and return "Hello Alexandre" | |
$mock = (new Mock('NamespaceVendor\\ClassName'))([ | |
'sayHelloTo' => function($name="Alexandre") { | |
return "Hello Alexandre"; |
Example 1:
$math = new Math;
$balance = 12.30;
$deposit = 1.70;
$total = $math->sum($balance, $deposit);
if ($total === 14)
echo 'Ok';
else
echo 'Fail';
<?php | |
namespace MyApp; | |
class HtmlHandler implements ViewHandler | |
{ | |
public function __invoke(Response $response) | |
{ | |
foreach ($response->getHeaders() as $header) | |
header($header); |
<?php | |
/** | |
* Simple loader class | |
* | |
* Usage: new Vortice\Common\Loader('Zend', './Zend'); | |
* @author Carlos André Ferrari <[email protected]> | |
*/ | |
namespace Vortice\Common; |
{% if cases_list.ProcessInstance is defined %} | |
{% for case in cases_list.ProcessInstance %} | |
{% for activity in case.activities.children() %} | |
<tr> | |
{% for variable in case.clientVariables.children() %} | |
{{ set value = variable.xpath('string[2]') }} | |
<td>{{ array_pop(value) }}</td> | |
{% endfor %} | |
<td><a href="{{ cloud_link_address }}{{ activity.uuid.value }}" target="_blank">{{ activity.name }}</a></td> | |
<td>#</td> |
<?php | |
/** | |
* SplClassLoader implementation that implements the technical interoperability | |
* standards for PHP 5.3 namespaces and class names. | |
* | |
* http://groups.google.com/group/php-standards/web/final-proposal | |
* | |
* // Example which loads classes for the Doctrine Common package in the | |
* // Doctrine\Common namespace. |