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
ziadoz / install.sh
Last active Nov 19, 2019
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
View install.sh
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# http://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# http://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# http://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# http://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
@ziadoz
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}"
}
@ziadoz
ziadoz / index.php
Last active Nov 13, 2019
Simple PHP / jQuery CSRF Protection
View index.php
<?php
// See: http://blog.ircmaxell.com/2013/02/preventing-csrf-attacks.html
// Start a session (which should use cookies over HTTP only).
session_start();
// Create a new CSRF token.
if (! isset($_SESSION['csrf_token'])) {
$_SESSION['csrf_token'] = base64_encode(openssl_random_pseudo_bytes(32));
}
@ziadoz
ziadoz / gmap.php
Created Mar 19, 2014
Generating a Static Google Map with PHP
View gmap.php
<?php
$url = 'http://maps.googleapis.com/maps/api/staticmap?';
$bits = array(
'center' => 'Calgary Tower, Calgary, AB, Canada',
'zoom' => '16',
'size' => '800x600',
'maptype' => 'roadmap',
'markers' => 'color:0x576d4e|label:N|49.6967179,-112.8450119',
'sensor' => 'false',
);
@ziadoz
ziadoz / awesome-php.md
Last active Nov 5, 2019
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
View awesome-php.md
@ziadoz
ziadoz / fix-osx-wifi-battery-drain.md
Last active Oct 29, 2019
Fix OSX battery draining on sleep due to wifi activity
View fix-osx-wifi-battery-drain.md

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
ziadoz / setup.md
Created Jul 22, 2017
Using XDebug in Atom Editor
View setup.md

Using XDebug in Atom Editor

Install the XDebug plugin for Atom and then add the following to the config.cson file (Atom > Config…):

"php-debug":
  PathMaps: [
    "remotepath;localpath"
    "/server/path/to/project/;/local/path/to/project/"
  ]
  ServerPort: 9001
@ziadoz
ziadoz / screenshot.js
Last active Oct 20, 2019
CasperJS Website Screenshots
View screenshot.js
// Usage: casperjs screenshot.js http://www.bbc.co.uk bbc.png
// https://gist.github.com/2310901
var casper = require('casper').create({
viewportSize: { width: 1024, height: 768 }
});
var utils = require('utils');
if (casper.cli.args.length < 2) {
@ziadoz
ziadoz / convert_video.sh
Last active Oct 10, 2019
MKV to MP4 (Docker, FFMpeg, AVConv)
View convert_video.sh
#!/usr/bin/env bash
# Convert MKV to MP4
# Uses Docker FFMpeg, FFMpeg or AVConv.
#
# Usage:
# ./convert_video.sh
# ./convert_video.sh /path/to/videos
#
# Notes:
@ziadoz
ziadoz / readme.md
Created Aug 30, 2019
Cloning Github Gists
View readme.md

Cloning Github Gists

To clone a gist:

git clone git@gist.github.com:[GIST ID].git

If you need to add a remote to an existing repository:

git remote add origin git@gist.github.com:[GIST ID].git
You can’t perform that action at this time.