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
<?hh | |
class Container implements ArrayAccess<string, string> | |
{ | |
protected Map<string, string> $mappings; | |
public function __construct() | |
{ | |
$this->mappings = new Map(); | |
} |
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
--- | |
- hosts: all | |
sudo: true | |
tasks: | |
- apt: update_cache=yes | |
- apt: pkg=libssl1.0.0 state=latest | |
- apt: pkg=openssl state=latest | |
- service: name=apache2 state=restarted | |
ignore_errors: yes | |
- service: name=nginx state=restarted |
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 DataCache | |
{ | |
protected $redis; | |
protected $ttl = 300; // Seconds | |
public function __construct($redis) | |
{ | |
$this->redis = $redis; |
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 | |
/** | |
* Parses the given Entry into its constituent parts. | |
* @param mixed $entry The entry to parse | |
* @return array | |
* @throws \InvalidArgumentException | |
*/ | |
protected function parseEntry($entry) | |
{ | |
if (is_array($entry) || $entry instanceof \ArrayAccess) { |
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 | |
/** | |
* Parses the given Entry into its constituent parts. | |
* @param mixed $entry The entry to parse | |
* @return array | |
* @throws \InvalidArgumentException | |
*/ | |
protected function parseEntry($entry) | |
{ | |
if (! is_array($entry) || $entry instanceof \ArrayAccess) { |
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 | |
function benchmark($name, $iterations, Closure $function) | |
{ | |
echo "Starting Benchmark: {$name} (".number_format($iterations)." Iterations)\n"; | |
$start = microtime(true); | |
for ($i = 0; $i < $iterations; $i++) { | |
$function(); | |
} | |
$elapsed = microtime(true) - $start; |
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/sh | |
function install_vagrant_plugin { | |
if [[ -z $(vagrant plugin list | grep "$1") ]]; then | |
vagrant plugin install $1 | |
else | |
echo "Vagrant Plugin '$1' already installed...skipping." | |
fi | |
} |
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
xdebug.profiler_enable = 1 | |
xdebug.profiler_output_dir = "/vagrant/cachegrind" | |
xdebug.profiler_output_name = "callgrind.out.%t.%p" |
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 | |
use ArrayIterator; | |
/** | |
* Implements ArrayAccess, Countable, IteratorAggregate | |
*/ | |
trait ParameterBagTrait | |
{ | |
/** |
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 | |
function require_in_context($__path, array $__context) | |
{ | |
extract($__context, EXTR_SKIP); | |
unset($__context); | |
ob_start(); | |
require $__path; |