Skip to content

Instantly share code, notes, and snippets.

View isostarec's full-sized avatar
🎯
Focusing

isostarec

🎯
Focusing
View GitHub Profile
@phpbits
phpbits / disable-blocks.php
Last active October 25, 2024 08:06
How to Disable Specific Blocks in the WordPress Gutenberg Block Editor using the allowed_block_types_all Hook
<?php
function disable_specific_blocks( $allowed_block_types, $post ) {
// Make sure allowed types is an array
if ( ! is_array( $allowed_block_types ) ) {
$allowed_block_types = array(
'core/block', // Required to enable "Reusable blocks" feature.
'core/columns',
'core/paragraph',
'core/image',
'core/heading',
@isostarec
isostarec / README.md
Created April 25, 2023 13:22 — forked from jimothyGator/README.md
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@Andrey2G
Andrey2G / encoding.txt
Last active April 12, 2025 01:01
Video Encoding with multiple resolutions
ffmpeg -i "c:/videos/sample.mp4
-map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0 -map 0:v:0 -map 0:a:0
-c:v libx264 -crf 22 -c:a aac -ar 48000
-filter:v:0 scale=w=480:h=360 -maxrate:v:0 600k -b:a:0 64k
-filter:v:1 scale=w=640:h=480 -maxrate:v:1 900k -b:a:1 128k
-filter:v:2 scale=w=1280:h=720 -maxrate:v:2 900k -b:a:2 128k
-var_stream_map "v:0,a:0,name:360p v:1,a:1,name:480p v:2,a:2,name:720p"
-preset slow -hls_list_size 0 -threads 0 -f hls -hls_playlist_type event -hls_time 3
-hls_flags independent_segments -master_pl_name "name-pl.m3u8"
"c:/videos/encoded/name-%v.m3u8"
@EmadAdly
EmadAdly / SSL-renewal.md
Last active December 16, 2024 07:59
Renew The Let’s Encrypt Certificate in bitnami

Renew The Let’s Encrypt Certificate

Let’s Encrypt certificates are only valid for 90 days. To renew the certificate before it expires, run the following commands from the server console as the bitnami user. Remember to replace the DOMAIN placeholder with your actual domain name, and the EMAIL-ADDRESS placeholder with your email address.

1- Login your server using SSH

ssh -i Key.pem [email protected]

2- Stop Apache Server

sudo /opt/bitnami/ctlscript.sh stop

@bradtraversy
bradtraversy / vscode_shortcuts.md
Last active April 18, 2025 13:45
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

@LayZeeDK
LayZeeDK / web-application-horizontal-layers.csv
Last active January 19, 2023 11:57
Horizontal layers of a web application.
Horizontal layer Examples
Business logic Application-specific logic, domain logic, validation rules
Persistence WebStorage, IndexedDB, File System Access API, HTTP, WebSocket, GraphQL, Firebase, Meteor
Messaging WebRTC, WebSocket, Push API, Server-Sent Events
I/O Web Bluetooth, WebUSB, NFC, camera, microphone, proximity sensor, ambient light sensor
Presentation DOM manipulation, event listeners, formatting
User interaction UI behaviour, form validation
State management Application state management, application-specific events
// Originally inspired by David Walsh (https://davidwalsh.name/javascript-debounce-function)
// Returns a function, that, as long as it continues to be invoked, will not
// be triggered. The function will be called after it stops being called for
// `wait` milliseconds.
const debounce = (func, wait) => {
let timeout;
// This is the function that is returned and will be executed many times
// We spread (...args) to capture any number of parameters we want to pass
@bUxEE
bUxEE / wp-recursive-menu.php
Last active April 28, 2024 15:07
Recursive menu/submenu list from wp_get_nav_menu_items. Change menu name and style to your needs. Supports unlimited number of submenus.
<?php
$menu_name = 'menu-name';
$locations = get_nav_menu_locations();
$menu = wp_get_nav_menu_object( $locations[ $menu_name ] );
$menuitems = wp_get_nav_menu_items( $menu->term_id, array( 'order' => 'DESC' ) );
//echo '<pre>'.print_r($menuitems).'</pre>';
function buildTree( array &$elements, $parentId = 0 )
{
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active June 5, 2025 15:33
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@staltz
staltz / introrx.md
Last active June 6, 2025 03:30
The introduction to Reactive Programming you've been missing