Skip to content

Instantly share code, notes, and snippets.

@nonsintetic
nonsintetic / readme.md
Last active May 6, 2025 12:42
PHP - Get YouTube subscriber count with Youtube API v3

How to:

Here's a 'simple' way to get the YouTube subscriber number from Google's Youtube API v3:

  1. Go to https://console.developers.google.com/apis/library
  2. Log in with your Google account.
  3. Next to the logo click on 'Project' and 'Create project'. Name it whatever you want and click on 'Create'.
  4. Wait until the project is created, the page will switch to it by itself, it will take a couple of seconds up to a minute. Once it's done it will be selected next to the logo.
  5. Once it's created and selected, click on 'Credentials' from the menu on the left.
  6. Click on 'Create Credentials' and choose 'API Key'. You can restrict it to specific IPs, or types of requests (website, android, ios etc.) if you want, it's safer that way.
@rniswonger
rniswonger / wp-disable-plugin-update.php
Last active November 18, 2024 16:54
WordPress - Disable specific plugin update check
/**
* Prevent update notification for plugin
* http://www.thecreativedev.com/disable-updates-for-specific-plugin-in-wordpress/
* Place in theme functions.php or at bottom of wp-config.php
*/
function disable_plugin_updates( $value ) {
if ( isset($value) && is_object($value) ) {
if ( isset( $value->response['plugin-folder/plugin.php'] ) ) {
unset( $value->response['plugin-folder/plugin.php'] );
}
@Moc
Moc / regex.php
Created February 19, 2019 15:41
<?php
$string1 = '<link href="/css/bs4-dynamic-fields-form-2.min.css" rel="stylesheet" media="screen">';
$string2 = '<script src="/cdn-cgi/apps/head/qx0HK83qWJ5I3r2xnETN-ETfo6s.js"></script>"';
$regex1 = '~<link(.*?)href="([^"]+)"(.*?)>~';
$regex2 = '/src=(["\'])(.*?)\1/';
$result1 = preg_match($regex1, $string1, $matches1);
$result2 = preg_match($regex2, $string2, $matches2);
@akotulu
akotulu / fns_tinybrowser.php
Last active November 14, 2022 21:28
TinyMCE's tinybrowser plugin Flash replacement
<?php
// Removed deprecated functions
// sql_regcase
/* Create Folder */
function createfolder($dir, $perm)
{
// prevent hidden folder creation
$dir = ltrim($dir, '.');
@Crocoblock
Crocoblock / cct-crud.md
Last active February 20, 2025 08:28
JetEngine CCT CRUD

Get/Create/Update/Delete CCT item

Check if CCT module active

$module_active = jet_engine()->modules->is_module_active( 'custom-content-types' );

Get type object and handler

$type_object is an instance of \jet-engine\includes\modules\custom-content-types\inc\factory.php \

@farichello
farichello / WP posts on map
Created December 19, 2024 08:13
WP posts on map
// SCF Google Map API Key
function my_acf_init() {
acf_update_setting('google_api_key', 'YOUR_API_KEY');
}
add_action('acf/init', 'my_acf_init');
function us_portfolio_google_map_shortcode() {
// Getting an API key
$google_api_key = acf_get_setting('google_api_key');