Skip to content

Instantly share code, notes, and snippets.

Jamie York ziadoz

Block or report user

Report or block ziadoz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
ziadoz /
Last active Jan 21, 2020
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
ziadoz /
Last active Jan 15, 2020
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# Versions
ziadoz /
Last active Jan 10, 2020
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 / 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 / stripe-checkout.html
Last active Dec 20, 2019
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 / log-errors.js
Created Dec 11, 2019
Log JS Errors via AJAX
View log-errors.js
// On error send to backend route which will log error into central logging service.
window.onerror = function(message, file, line) {
method: 'POST',
headers: {
'Content-Type': 'application/json'
body: JSON.stringify({
ziadoz / halt_compiler.php
Last active Dec 4, 2019
Using PHP Halt Compiler
View halt_compiler.php
* The __halt_compiler() function will stop the PHP compiler when called.
* You can then use the __COMPILER_HALT_OFFSET__ constant to grab the contents of the PHP file after the halt.
* In this example a PHP template is stored after the halt, to allow simple separation of logic from templating.
* The template is stored in a temporary file so it can be included and parsed.
* See:
ziadoz /
Created Dec 4, 2019
Run Ansible Playbook Against Host
# Replace [IP], [USER], [KEY] and [PLAYBOOK]
# Comma after IP address is required, otherwise the command won't work.
ansible-playbook -i [IP], --user=[USER] --private-key=[KEY] [PLAYBOOK]
ziadoz / index.php
Last active Nov 24, 2019
Simple PHP / jQuery CSRF Protection
View index.php
// See:
// Start a session (which should use cookies over HTTP only).
// Create a new CSRF token.
if (! isset($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = base64_encode(openssl_random_pseudo_bytes(32));
ziadoz / composer_path.json
Last active Nov 18, 2019
Composer Using Local Repositories and Branches
View composer_path.json
"repositories": [
"type": "path",
"url": "../relative/project/path"
"require": {
"${project}": "dev-${branch}"
You can’t perform that action at this time.