Skip to content

Instantly share code, notes, and snippets.

View assertchris's full-sized avatar
💭
I may be slow to respond.

Christopher Pitt assertchris

💭
I may be slow to respond.
View GitHub Profile
❯ phpunit --coverage-html=report
PHPUnit 4.1.4 by Sebastian Bergmann.
Configuration read from /path/to/phpunit.xml
................................................................. 65 / 85 ( 76%)
....................
Time: 6.87 minutes, Memory: 116.25Mb
<?php
trait GreetName
{
/**
* @return array
*/
public function interfacesForGreetName()
{
return [HasGreeting::class, HasName::class];
<?php
function array_difference(array $first, array $second) {
return array_merge(
array_diff($first, $second),
array_diff($second, $first)
);
}
<?php
use Symfony\Component\Console\Output\StreamOutput;
$handle = fopen("php://output", "w");
$stream = new StreamOutput($handle);
Artisan::call("migrate", ["--path" => "Acme/Migration"], $stream);
<?php
interface Action
{
public function matches(array $message);
public function handle($inbox, array $message);
}
class TwitterAction implements Action
{
scrutinizer:
inherit: true
tools:
external_code_coverage: true
checks:
php:
code_rating: true
duplication: true
filter:
paths: [src/*, tests/*]
#!/bin/bash
name=$(date +%s)
cd ../
mkdir "temp_${name}"
cd "temp_${name}"
<?php
use Symfony\Component\Process\Process;
$process = new Process('...');
$process->run(function ($type, $buffer) {
if (Process::ERR === $type) {
echo 'ERR > '.$buffer;
} else {
function bubble(data) {
var length = data.length;
while (length) {
for (var i = 1; i < length; i++) {
var prev = data[i - 1];
var next = data[i];
if (prev > next) {
data[i] = prev;
function merge(data) {
var length = data.length;
if (length === 1) {
return [data[0]];
}
if (length === 2) {
if (data[0] > data[1]) {
return [data[1], data[0]];