Skip to content

Instantly share code, notes, and snippets.


Jamie York ziadoz

View GitHub Profile
ziadoz /
Last active Feb 27, 2021
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# Versions
ziadoz / scrape.php
Created Aug 13, 2012
Scraping Google using PHP and Goutte:
View scrape.php
* Todo: Send a random user agent string and sleep a random amount between requests.
// Extract and sanatize input:
$domain = filter_input(INPUT_POST, 'domain', FILTER_SANITIZE_URL);
$terms = filter_input(INPUT_POST, 'terms', FILTER_SANITIZE_STRING);
// Setup Goutte (which also includes Guzzle):
ziadoz / index.html
Last active Feb 14, 2021
HTML5 Webcam / CSS3 Image Filter Experiment
View index.html
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8" />
<title>Image from Webcam</title>
<style type="text/css">
video { display: block; margin: 0 auto; border: 10px solid #ccc; }
.button { margin: 10px auto; padding: 10px; background: #ccc; color: white; text-align: center; width: 200px; cursor: pointer; }
ziadoz /
Last active Jan 20, 2021
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
ziadoz /
Last active Jan 7, 2021
Fix Xbox One Controller issues after Windows 10 Anniversary update

Fix Xbox One Controller on Windows 10 Anniversary

After the Windows 10 Anniversary update Xbox One Controllers may start showing up as two XInput devices in Steam, and button presses occur twice.

To fix this you need to patch in the xinputhid.sys file from an earlier Windows 7 driver.

Note: This fix only works for connecting the controller via USB cable or USB wireless adapter, the new Bluetooth controller when paired still doesn't work.

Download the Windows 7 Driver

ziadoz / stripe-checkout.html
Last active Jan 5, 2021
Custom Stripe Checkout Button
View stripe-checkout.html
<form action="." method="post">
<noscript>You must <a href="" target="_blank">enable JavaScript</a> in your web browser in order to pay via Stripe.</noscript>
value="Pay with Card"
data-name="Example Company Inc"
ziadoz /
Last active Dec 28, 2020
Fix OSX battery draining on sleep due to wifi activity

Fix OSX battery draining on sleep due to wifi activity

Install SleepWatcher using Homebrew:

sudo chown -R $(whoami) /usr/local
brew update
brew install sleepwatcher

Start the SleepWatcher service:

ziadoz / .php_cs.dist
Last active Dec 15, 2020
Strictish PHP CS Fixer Configuration
View .php_cs.dist
return PhpCsFixer\Config::create()
'@PSR2' => true,
'align_multiline_comment' => ['comment_type' => 'all_multiline'],
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'backtick_to_shell_exec' => true,
ziadoz /
Last active Dec 4, 2020
Quick PHP 8.0 Install - Ubuntu 18.04
#!/usr/bin/env bash
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y \
php8.0 php8.0-bcmath php8.0-bz2 php8.0-cgi php8.0-cli php8.0-common php8.0-curl php8.0-dba php8.0-dev \
php8.0-enchant php8.0-fpm php8.0-gd php8.0-gmp php8.0-imap php8.0-interbase php8.0-intl php8.0-ldap \
php8.0-mbstring php8.0-mysql php8.0-odbc php8.0-opcache php8.0-pgsql php8.0-phpdbg php8.0-pspell php8.0-readline \
php8.0-snmp php8.0-soap php8.0-sqlite3 php8.0-sybase php8.0-tidy php8.0-xml php8.0-xsl php8.0-zip
ziadoz / php80_attributes.php
Last active Dec 4, 2020
Using PHP 8.0 Attributes/Annotations To Decorate Functions
View php80_attributes.php
// Attributes (AKA Annotations).
#[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_FUNCTION)]
class CharDecoratorAttribute
public function __construct(protected string $char) // Constructor Property Promotion
public function decorate(Closure $fn): Closure