Skip to content

Instantly share code, notes, and snippets.

View webdevsuperfast's full-sized avatar
🏠
Working from home

Rotsen Mark Acob webdevsuperfast

🏠
Working from home
View GitHub Profile
@webdevsuperfast
webdevsuperfast / README.md
Created June 19, 2020 05:10 — forked from hofmannsven/README.md
Storing WordPress files and database with WP-CLI on the server.
@webdevsuperfast
webdevsuperfast / .zshrc
Created May 5, 2020 01:37
Oh-My-ZSH, Antigen configuration on MacOS
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Composer Path
export PATH="$PATH:$HOME/.composer/vendor/bin"
@webdevsuperfast
webdevsuperfast / README.md
Last active March 17, 2021 13:03
Various ways on creating WordPress backups without a plugin with SSH

Backup WordPress Sites without Plugin

Method 1

  • Make sure SSH is enabled on client server.
  • Run ssh username@websitename.com
  • Run mysqldump -u dbusername -p dbname > backup_dbname.sql
  • Once inside run rsync -avz public_html/ testservername@testserver.com:public_html/testfolder
  • Log in to your test server using SSH.
  • Navigate to the test site folder with cd public_html/subdomain-folder.
  • Run find . -type f -exec chmod 644 {} \; for files.
  • Run find . -type d -exec chmod 755 {} \; for directories.
@webdevsuperfast
webdevsuperfast / .htaccess
Created March 7, 2020 01:16
WordPress load images from production
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# If images not found on development site, load from production
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^wp-content/uploads/[^/]+/.+\.(jpe?g|jpg|png|gif)$ https://example.com/$0 [R=302,L]
@webdevsuperfast
webdevsuperfast / yt_settings.json
Last active June 6, 2023 22:30
My settings for Enhancer for Youtube extension on Firefox
{
"version": "2.0.107.2",
"settings": {
"blur": 0,
"brightness": 100,
"contrast": 100,
"grayscale": 0,
"huerotate": 0,
"invert": 0,
"saturate": 100,
@webdevsuperfast
webdevsuperfast / functions.php
Last active February 22, 2020 02:54
Update Netlify Build on WordPress Post Update
<?php
// @link https://github.com/gatsbyjs/gatsby/issues/2753#issuecomment-387700344
add_action( 'save_post', 'fireFunctionOnSave' );
function fireFunctionOnSave($post_id)
{
if(wp_is_post_revision($post_id) || wp_is_post_autosave($post_id)) {
return;
}
// @link https://stats.seandolinar.com/automatically-build-gatsbyjs-site-when-publishing-wordpress-post/
@webdevsuperfast
webdevsuperfast / wordpress-base-custom-data.php
Created September 9, 2019 04:20 — forked from paulund/wordpress-base-custom-data.php
A PHP class to handle CRUD functionality in WordPress default tables.
<?php
/**
* Abstract class which has helper functions to get data from the database
*/
abstract class Base_Custom_Data
{
/**
* The current table name
*
* @var boolean
@webdevsuperfast
webdevsuperfast / README.md
Created September 27, 2018 23:55 — forked from eddywashere/README.md
Load third party javascript asynchronously, initialize queue for method calls, replace queue function, profit?

live demo

Files:

  • index.html: example of queue (the part that is always shown)
  • third-party.js: example of third party javascript (the part no one ever talks about)

Inspiration:

  • google analytics
@webdevsuperfast
webdevsuperfast / functions.php
Last active September 5, 2018 19:30
Disable Gravity Forms Captcha on Mobile
<?php
add_filter( 'gform_pre_render', 'disable_captcha' );
add_filter( 'gform_pre_validation', 'disable_captcha' );
// add_filter( 'gform_pre_validation', 'disable_captcha' );
// add_filter( 'gform_admin_pre_render', 'disable_captcha' );
add_filter( 'gform_pre_submission_filter', 'disable_captcha' );
function disable_captcha( $form ) {
foreach( $form['fields'] as $key => $field ) {
if ( $field->type === 'captcha' && wp_is_mobile() ) {
unset( $form['fields'][$key] );
@webdevsuperfast
webdevsuperfast / ffmpeg_mkv_mp4_conversion.md
Created August 31, 2018 00:11 — forked from jamesmacwhite/ffmpeg_mkv_mp4_conversion.md
Easy way to convert MKV to MP4 with ffmpeg

Converting mkv to mp4 with ffmpeg

Essentially just copy the existing video and audio stream as is into a new container, no funny business!

The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.

With ffmpeg this can be achieved with -c copy. Older examples may use -vcodec copy -acodec copy which does the same thing.

These examples assume ffmpeg is in your PATH. If not just substitute with the full path to your ffmpeg binary.

Single file conversion example