Skip to content

Instantly share code, notes, and snippets.

View assertchris's full-sized avatar

Christopher Pitt assertchris

View GitHub Profile
function fitToScreen(selector) {
var element = document.querySelector(selector);
var width = element.offsetWidth;
var height = element.offsetHeight;
var top = "-" + (height / 2) + "px";
var left = "-" + (width / 2) + "px";
var ratio = getRatio(width, height);
<?php
interface Task
{
/**
* @return bool
*/
public function shouldLog();
}
while 1; do; sleep 0.25; clear; ps -ax -o %cpu,command | grep worker.php; done
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Removing dflydev/markdown (v1.0.0)
- Removing nikic/php-parser (v0.9.0)
- Installing nikic/php-parser (v0.9.5)
Loading from cache
- Removing doctrine/instantiator (1.0.2)
- Installing doctrine/instantiator (1.0.5)
Loading from cache
<?php
function bubble_recursive(array $items, $iterations = null) {
if ($iterations === null) {
$iterations = count($items);
}
$items = bubble_recursive_inner($items, $iterations);
if ($iterations > 1) {
<?php
Route::get("/test/{admin?}", function($admin = "zaher") {
dd($admin);
});
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]];
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;
<?php
function valid($file) {
if (file_exists($file)) {
$command = PHP_BINARY . " -l " . escapeshellarg($file) . " 2> /dev/null";
ob_start();
exec($command, $result);
ob_end_clean();
<?php
use Symfony\Component\Process\Process;
$process = new Process('...');
$process->run(function ($type, $buffer) {
if (Process::ERR === $type) {
echo 'ERR > '.$buffer;
} else {