Skip to content

Instantly share code, notes, and snippets.

View alinademi's full-sized avatar

Ali Demi alinademi

  • Vancouver
View GitHub Profile
@alinademi
alinademi / ffmpeg.md
Created March 3, 2023 00:29 — forked from steven2358/ffmpeg.md
FFmpeg cheat sheet
@alinademi
alinademi / remove dashboard widgets
Created February 11, 2023 01:49 — forked from karlazz/remove dashboard widgets
remove dashboard widgets
// https://deluxeblogtips.com/remove-dashboard-widgets-in-wordpress/
add_action('admin_init', 'rw_remove_dashboard_widgets');
function rw_remove_dashboard_widgets() {
remove_meta_box('dashboard_right_now', 'dashboard', 'normal'); // right now
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); // recent comments
remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal'); // incoming links
remove_meta_box('dashboard_plugins', 'dashboard', 'normal'); // plugins
remove_meta_box('dashboard_quick_press', 'dashboard', 'normal'); // quick press
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'normal'); // recent drafts
@alinademi
alinademi / get_parent_block_field.php
Created January 22, 2023 23:12 — forked from joseph-farruggio/get_parent_block_field.php
Returns a specified field from the parent ACF block.
<?php
/**
* Returns a specified ACF field from a parent block
* @param string $child_id The ID of the child ACF block
* @param string $child_name The name of the child ACF block
* @param string $parent_name The name of the parent ACF block
* @param string $field The name of the parent's custom field to return
* @param boolean $return_first If $field is an array, optionally return the first item.
*/
function get_field_from_parent($child_id, $child_name, $parent_name, $field, $return_first = false) {
@alinademi
alinademi / bash-script-base.sh
Created January 7, 2023 00:07 — forked from erawhctim/bash-script-base.sh
Bash script starter file - colors, status messages, custom functions, etc
#!/bin/sh
# Originally pulled from: https://robots.thoughtbot.com/shell-script-suggestions-for-speedy-setups
# Exit if any subcommand fails
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
@alinademi
alinademi / keybindings.json
Last active December 15, 2022 23:25 — forked from airyboy/keybindings.json
Use vim like keybindings ctrl+shift+j, ctrl+shift+k, ctrl+shift+l for intellisense (suggestion menu) in VSCode
{
"key": "ctrl+shift+j",
"command": "selectNextSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
},
{
"key": "ctrl+shift+k",
"command": "selectPrevSuggestion",
"when": "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"
}
@alinademi
alinademi / functions.php
Created December 10, 2022 04:57 — forked from barbwiredmedia/functions.php
Wordpress SEO Yoast Order meta box. This will change the priority of Yoasts meta box and move it to the bottom of all pages / posts.
// Move Yoast Meta Box to bottom
function yoasttobottom() {
return 'low';
}
add_filter( 'wpseo_metabox_prio', 'yoasttobottom');
@alinademi
alinademi / close-yoast-metabox.php
Last active January 10, 2023 05:41 — forked from mikeott/close-yoast-metabox.php
Force the Yoast metabox to be closed by default.
function collapse_yoast_matabox()
{
if (!class_exists('WPSEO_Metabox')) {
return;
}
echo /*html*/ '
<script>
document.addEventListener("DOMContentLoaded",
function(event) {
document.querySelector(".yoast.wpseo-metabox").classList.add("closed");
@alinademi
alinademi / laravel-nova-authorized.php
Created August 29, 2022 05:00 — forked from dev-lav/laravel-nova-authorized.php
laravel-nova-authorized.php
<?php
// add this code on your nova resource
public function authorizedToUpdate(Request $request)
{
return false;
}
public function authorizedToDelete(Request $request)
@alinademi
alinademi / homebrew-permissions-issue.md
Created July 26, 2022 16:31 — forked from irazasyed/homebrew-permissions-issue.md
Homebrew: Permissions Denied Issue Fix (OS X / macOS)

Homebrew Permissions Denied Issues Solution

sudo chown -R $(whoami) $(brew --prefix)/*

@alinademi
alinademi / extend-wp-rest-api.php
Created July 13, 2022 23:31 — forked from mahlamusa/extend-wp-rest-api.php
Extend WordPress REST API with custom rest fields and endpoints
<?php
/**
* Register custom rest fields
*/
add_action( 'rest_api_init', 'register_custom_fields' );
/**
* Register rest fields and endpoint
*