Skip to content

Instantly share code, notes, and snippets.

@ozws
ozws / README.md
Created November 13, 2023 01:29 — forked from astockwell/README.md
PHP Video Url Parser

Youtube/Vimeo Video Url Parser

Parses URLs from major cloud video providers. Capable of extracting keys from various video embed and link urls to manipulate and access videos in various ways.

Usage

VideoUrlParser::identify_service("https://www.youtube.com/watch?v=x_8kFbZf20I&feature=youtu.be");
@ozws
ozws / youtube_id_regex.php
Created November 13, 2023 01:24 — forked from ghalusa/youtube_id_regex.php
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ
@ozws
ozws / Minify.php
Last active August 19, 2021 02:20
php class Minify
namespace YourNamespace;
class Minify {
/*
Use:
Minify::html( string )
Minify::css( string )
@ozws
ozws / delete-all-ds_store-files.sh
Last active July 16, 2018 12:42
Recursively delete all .DS_Store files in a directory on macOS
#!/bin/bash
## Recursively delete all .DS_Store files in a directory on macOS.
# ! WARNING: You assume any and all liability !
# Open your terminal app of choice
# cd to folder
cd /path/to/folder
@ozws
ozws / Contract Killer 3.md
Created April 29, 2016 20:21
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post

@ozws
ozws / wp-config.php
Last active January 10, 2021 22:05
Oz wp-config
<?php
/*
Additional notes for this gist:
- You'll see that half of the constants are commented out. Nice to
have them there when needed.
- Using a non-standard WP directory structure.
- See BuB note below. Possible items to change during migration:
- $table_prefix
- $dbname, $dbuser, $dbpass
*/