Skip to content

Instantly share code, notes, and snippets.

View ziadoz's full-sized avatar

Jamie York ziadoz

View GitHub Profile
@ziadoz
ziadoz / awesome-php.md
Last active May 10, 2024 15:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@ziadoz
ziadoz / unfollow.js.md
Created April 26, 2024 19:31 — forked from JamieMason/unfollow.js.md
Unfollow everyone on twitter.com

Unfollow everyone on twitter.com

  1. Go to https://twitter.com/YOUR_USER_NAME/following
  2. Open the Developer Console. (COMMAND+ALT+I on Mac)
  3. Paste this into the Developer Console and run it
// Unfollow everyone on twitter.com, by Jamie Mason (https://twitter.com/fold_left)
// https://gist.github.com/JamieMason/7580315
//
@ziadoz
ziadoz / dom-props.html
Created April 24, 2024 18:06
DOM Properties
<div id="app"></div>
<script>
const option = document.createElement('option');
option.value = 'Foo Bar';
const datalist = document.createElement('datalist');
datalist.id = 'foo-bar';
datalist.appendChild(option);
@ziadoz
ziadoz / halt_compiler.php
Last active April 23, 2024 17:55
Using PHP 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: https://github.com/bobthecow/mustache.php/blob/dev/src/Mustache/Loader/InlineLoader.php
* http://php.net/manual/en/function.halt-compiler.php
*/
@ziadoz
ziadoz / install.sh
Last active April 20, 2024 10:18
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# https://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# https://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# https://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# https://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE`
@ziadoz
ziadoz / Handler.php
Created April 5, 2024 15:08
Laravel - Report All Exceptions
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
public function register(): void
@ziadoz
ziadoz / record-chrome.sh
Created March 28, 2024 21:47
macOS Screen Record Google Chrome
#!/usr/bin/env bash
screencapture -R$(osascript -e 'tell app "Google Chrome" to get the bounds of the front window' | tr -d '[:space:]') -C -o -x -k -v ~/Desktop/chrome.mov
@ziadoz
ziadoz / phpstorm.sh
Created March 25, 2024 17:21
PhpStorm - Compare Files
#!/usr/bin/env bash
# @see: https://www.jetbrains.com/help/phpstorm/working-with-the-ide-features-from-command-line.html
# @see: https://www.jetbrains.com/help/phpstorm/comparing-files-and-folders.html#comparing_folders
# Usage: phpstorm diff [a] [b]
# View > Compare With
open -na "PhpStorm.app" --args "$@"
@ziadoz
ziadoz / chrome-headless.sh
Created March 25, 2024 16:18
Chrome Headless - Screenshot, Snapshot and PDF
#!/usr/bin/env bash
# Slugify a string
# @see: https://duncanlock.net/blog/2021/06/15/good-simple-bash-slugify-function/
# @see: https://gist.github.com/oneohthree/f528c7ae1e701ad990e6
function slugify() {
iconv -t ascii//TRANSLIT \
| tr -d "'" \
| sed -E 's/[^a-zA-Z0-9]+/-/g' \
| sed -E 's/^-+|-+$//g' \
@ziadoz
ziadoz / fix-osx-wifi-battery-drain.md
Last active March 25, 2024 13:42
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: