Skip to content

Instantly share code, notes, and snippets.

View ziadoz's full-sized avatar

Jamie York ziadoz

View GitHub Profile
@ziadoz
ziadoz / config.php
Created August 21, 2024 11:17
Pydantic Settings for PHP
<?php
// @see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#usage
final readonly class DatabaseConfig
{
#[Concat(
#[Env('DB_HOST')],
#[Str('://')],
#[Env('DB_USER')],
#[Str('@')],
@ziadoz
ziadoz / MyCommand.php
Last active August 20, 2024 19:31
Laravel 11.21 Container Contextual Attributes
<?php
/*
Contextual attributes were implementated by @innocenzi and @ollieread:
- https://github.com/laravel/framework/pull/51934
- https://github.com/laravel/framework/pull/52428
I added contextual attributes for the core drivers:
- https://github.com/laravel/framework/pull/52265
@ziadoz
ziadoz / readme.txt
Created August 12, 2024 12:19
Darksiders 1 Warmastered Edition PC - Camera Speed Bug
The in-game camera speed when using a controller is really slow.
The issue appears to be caused by Steam Input:
Steam > Settings > Controller > Disable Enable Steam Input for Switch Pro controllers
You'll know when the change has worked because the camera speed will be a lot faster, and also controller button icons in the user interface will be grey/generic rather than Xbox coloured.
@ziadoz
ziadoz / select-options-hide.html
Last active August 6, 2024 13:40
Hide/Disable Select Options in Browsers (Safari Bug)
<!-- Most browsers support "display: none;" on select options to hide them. -->
<!-- However, Safari doesn't support this, and will still display the option. -->
<!-- The solution is to "display: none;" and disable the option. -->
<!-- The option will be hidden in most browsers, but still disabled in Safari. -->
<select>
<option></option>
<option value="foo">Foo</option>
<option value="bar">Bar</option>
<option value="baz">Baz</option>
@ziadoz
ziadoz / date-hms.js
Created July 9, 2024 11:13
JS - Get Hours, Minutes and Seconds from Date
console.log(
new Intl.DateTimeFormat('en-GB', { hour: 'numeric', minute: 'numeric', second: 'numeric' })
.formatToParts(new Date)
.map((part) => part.value)
.join('')
);
@ziadoz
ziadoz / reading-list.js
Created June 3, 2024 19:54
Extract Safari Reading List Bookmarks
// Export bookmarks, open HTML, run this:
const links = [];
document.querySelectorAll('body > dt:nth-of-type(4) a').forEach((a) => {
links.push(a.getAttribute('href'));
});
links.join("\n");
@ziadoz
ziadoz / unbookmark.js
Last active August 29, 2025 17:09
Mastodon - Delete All Bookmarks
// Inspired by Twitter Unfollow All: https://gist.github.com/ziadoz/caa882e75c11be9e8064e570ffec1f5f
(() => {
const $bookmarkButtons = 'button.status__action-bar__button.bookmark-icon';
const retry = {
count: 0,
limit: 3,
};
@ziadoz
ziadoz / git-obliterate.sh
Created May 24, 2024 20:36
Git Obliterate - Remove files from entire Git repository history
#!/usr/bin/env bash
# @link: https://github.com/tj/git-extras
# Install
brew install git-extras
# Usage
git-obliterate secrets.json
@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);