Skip to content

Instantly share code, notes, and snippets.

@rmbl
rmbl / backtrace.php
Created June 14, 2013 10:53
Backtrace on fatal_error in PHP
<?php
function shutdown() {
$error = error_get_last();
if ($error['type'] === E_ERROR) {
// fatal error has occured
$trace = array_reverse($GLOBALS['dbg_stack']);
array_pop($trace);
if(php_sapi_name() == 'cli') {
echo 'Backtrace for: \'' . $error['message'] . '\' at ' . $error['file'] . ':' . $error['line'] . ':' . "\n";
foreach($trace as $item)
@amberj
amberj / setup-headless-selenium-xvfb.sh
Created September 25, 2013 05:06
Bash script to install/setup headless Selenium (uses Xvfb and Chrome)
#!/bin/bash
#
# Bash script to setup headless Selenium (uses Xvfb and Chrome)
# (Tested on Ubuntu 12.04)
# Add Google Chrome's repo to sources.list
echo "deb http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee -a /etc/apt/sources.list
# Install Google's public key used for signing packages (e.g. Chrome)
# (Source: http://www.google.com/linuxrepositories/)