Skip to content

Instantly share code, notes, and snippets.

View alinademi's full-sized avatar

Ali Demi alinademi

  • Vancouver
View GitHub Profile
@alinademi
alinademi / bundle-size.yaml
Created January 3, 2025 21:58 — forked from khromov/bundle-size.yaml
GitHub Actions Bundle size comparison
name: 'Bundle Size Comparison'
on:
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
@alinademi
alinademi / style.css
Created December 14, 2024 05:48 — forked from ajvillegas/style.css
Wide and Full-Width Alignment in WP
/* Break out of a container in a WP site. */
/* Exclude blocks in the editor. */
.alignfull:not(.wp-block) {
margin-left: calc( 50% - 50vw );
margin-right: calc( 50% - 50vw );
max-width: 100vw;
}
.alignwide {
@alinademi
alinademi / remove-taxonomy-meta-box.php
Created December 14, 2024 03:37 — forked from ajvillegas/remove-taxonomy-meta-box.php
Remove Taxonomy Meta Box from Edit Screen
<?php
function register_custom_taxonomy() {
$taxonomy_labels = [
'name' => esc_html__( 'Custom Terms', 'text-domain' ),
'singular_name' => esc_html__( 'Custom Term', 'text-domain' ),
'menu_name' => esc_html__( 'Terms', 'text-domain' ),
];
$taxonomy_args = [
@alinademi
alinademi / 01-custom-block.js
Created December 14, 2024 02:17 — forked from ajvillegas/01-custom-block.js
Sample custom WordPress editor block and sidebar controls using using ES5 JavaScript syntax.
/**
* Custom WordPress block boilerplate.
*
* @package My_Block_Package
* @author Alexis J. Villegas
* @link http://www.alexisvillegas.com
* @license GPL-2.0+
*/
( function( blocks, editor, element ) {
@alinademi
alinademi / functions.php
Created December 7, 2024 02:00 — forked from gmmedia/functions.php
Add featured image column to WP admin panel - posts AND pages
<?php
/**
* Add featured image column to WP admin panel - posts AND pages
* See: https://bloggerpilot.com/featured-image-admin/
*/
// Set thumbnail size
add_image_size( 'j0e_admin-featured-image', 60, 60, false );
@alinademi
alinademi / clean-ubuntu
Created November 27, 2024 03:37 — forked from SerhatTeker/clean-ubuntu
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
# vim: set ft=sh et ts=4 sw=4 sts=4:
# INFO
# --------------------------------------------------------------------------------------
# Free up disk space on Debian, Ubuntu - clean log, cache, archive packages/apt archives,
# orphaned packages, old kernel and remove the trash
#
# Gist repo:
@alinademi
alinademi / simple-google-apis.php
Created December 14, 2023 03:07 — forked from kingkool68/simple-google-apis.php
Interacting with Google API's using their PHP libraries is a nightmare. Skip the headache by authorizing a Guzzle client and make raw HTTP requests instead!
<?php
$key_file_path = __DIR__ . '/service-account-credentials.json';
$google_client = new \Google_Client();
$google_client->setAuthConfig( $key_file_path );
// Set the scopes of whatever you need access to
// See https://developers.google.com/identity/protocols/oauth2/scopes
$google_client->setScopes( array( 'https://www.googleapis.com/auth/analytics.readonly' ) );
$http_client = $client->authorize();
<?php
function rh_filter_the_content( $the_content = '' ) {
$blocks = parse_blocks( $the_content );
$new_block = array(
'blockName' => 'core/paragraph',
'attrs' => array(),
'innerBlocks' => array(),
'innerHTML' => '<p>Hello World</p>',
'innerContent' => array(
'<p>Hello World</p>',
<?php
/**
* A function that takes an array of HTML attribute
* key/value pairs and returns a string of HTML attributes.
**/
function unwrap_html_attrs($attrs)
{
$attributes = '';
@alinademi
alinademi / zsh.md
Created August 10, 2023 23:32 — forked from webdevsuperfast/zsh.md
Install ZSH using Homebrew and set as default shell in Linux/WSL

Install ZSH via HomeBrew

brew install zsh

Add ZSH to /etc/shells

echo $(which zsh) | sudo tee -a /etc/shells

Set ZSH as default user shell

sudo chsh -s $(which zsh) $USER

Execute Shell or just restart terminal to take effect