Skip to content

Instantly share code, notes, and snippets.

View mustafakucuk's full-sized avatar
💻
coding...

Mustafa KÜÇÜK mustafakucuk

💻
coding...
View GitHub Profile
@igorjs
igorjs / rest-api-response-format.md
Last active May 2, 2024 03:53
REST API response format based on some of the best practices
@davidrleonard
davidrleonard / add-team-to-repos.js
Last active April 9, 2024 18:49
Add a new team to all Github repos in an organization
/*
* Adds a team to all the repos in a Github organization. This is a tedious
* process in the UI. You'll need a newer version of node to run this (e.g 9+)
* because it uses async/await.
*
* Instructions:
*
* 1. Copy this file somewhere on your computer, e.g. ~/addteamrepos.js
* 2. Fill in the uppercase variables below with the right values
* 3. Run this file: `$ node ~/addteamrepos.js`
@relliv
relliv / common.php
Last active August 30, 2021 09:43
Secure GET & POST Methods
<?php
class Common
{
/*--------------------- $_GET & $_POST ----------------- START */
/**
* Get $_GET content, array or array item in filtered way
*
* @param object $parameter could be array or array item
@scottparry
scottparry / functions.php
Created February 21, 2018 07:04
Enqueue Google fonts in WordPress theme
/**
* Enqueue custom fonts using protocol relative URL.
*
* Syntax: wp_enqueue_style( $handle, $src, $deps, $ver, $media );
* Ensure $handle is unique to prevent conflicts with plugins
*
* Note(s): The pipe (|) operator is used to load multiple typefaces in a single call. We also only load the weights we want * by comma seperating them, instead of loading every available weight.
*/
function theme_prefix_fonts()
{
add_filter( 'acf/get_valid_field', 'change_post_content_type');
function change_post_content_type( $field ) {
if($field['type'] == 'wysiwyg') {
$field['tabs'] = 'visual'; $field['toolbar'] = 'basic'; $field['media_upload'] = 0;
}
return $field; }
if(!function_exists('get_theme_file_uri')){
function get_theme_file_uri( $file = '' ) {
$file = ltrim( $file, '/' );
if ( empty( $file ) ) {
$url = get_stylesheet_directory_uri();
} elseif ( file_exists( get_stylesheet_directory() . '/' . $file ) ) {
$url = get_stylesheet_directory_uri() . '/' . $file;
} else {
$url = get_template_directory_uri() . '/' . $file;
}
[
{
"il": "Adana",
"plaka": 1,
"ilceleri": [
"Aladağ",
"Ceyhan",
"Çukurova",
"Feke",
"İmamoğlu",
@elalemanyo
elalemanyo / ampify_img.php
Last active August 27, 2021 12:33
Make img AMP-ready
<?php
/**
* Replace img tag with amp-img
*
* <amp-img src="[src]"
* width="[width]"
* height="[height]"
* layout="responsive"
* alt="[alt]">
* </amp-img>
@nonsintetic
nonsintetic / readme.md
Last active January 19, 2024 10:57
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.
@mikaelz
mikaelz / delete-all-woocommerce-products.php
Last active April 30, 2024 06:07
Remove all WooCommerce products from database via SQL
<?php
require dirname(__FILE__).'/wp-blog-header.php';
$wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')");
$wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'");
$wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)");
$wpdb->query("DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_posts WHERE post_type IN ('product','product_variation')");