Skip to content

Instantly share code, notes, and snippets.

View andrejIka's full-sized avatar

Andrej B. andrejIka

View GitHub Profile
// Here You can type your custom JavaScript...
document.onkeydown = function(evt) {
evt = evt || window.event;
console.log(evt.keyCode);
if (evt.keyCode == 78) {
//alert("Escape");
document.querySelector('a.pg:last-child').dispatchEvent(new MouseEvent('click'));
}
if (evt.keyCode == 80) {
@andrejIka
andrejIka / basic-block-styles.css
Created June 26, 2019 08:10 — forked from itsdavidmorgan/basic-block-styles.css
WordPress Gutenberg Basic Block Styles
/************************************************
Audio Blocks
************************************************/
.wp-block-audio {
margin-left: 0px;
margin-right: 0px;
}
.wp-block-audio audio {
width: 100%;
@andrejIka
andrejIka / vpn.md
Created July 5, 2019 00:46 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

A Russian translation of this article can be found here, contributed by Timur Demin. There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.

Why not?

@andrejIka
andrejIka / functions.php
Created July 5, 2019 18:23
Change from to wordpress email
<?php
// first
add_filter( 'wp_mail_from', 'wpse_new_mail_from' );
function wpse_new_mail_from( $old ) {
return 'your email address'; // Edit it with your email address
}
add_filter('wp_mail_from_name', 'wpse_new_mail_from_name');
function wpse_new_mail_from_name( $old ) {
@andrejIka
andrejIka / wp_insert_attachment_from_url.php
Created September 24, 2019 17:18 — forked from m1r0/wp_insert_attachment_from_url.php
WP: Insert attachment from URL
<?php
/**
* Insert an attachment from an URL address.
*
* @param String $url
* @param Int $parent_post_id
* @return Int Attachment ID
*/
function crb_insert_attachment_from_url($url, $parent_post_id = null) {
@andrejIka
andrejIka / gist:9c4b9aeeef6520ea3415cebd8a9a2b17
Created November 3, 2019 13:24
Register/Unregister style/script
function enqueue_styles() {
wp_dequeue_style( 'contact-form-7' );
// wp_dequeue_style( 'contact-form-7-bootstrap-style' );
}
add_action( 'wpcf7_enqueue_styles', 'enqueue_styles' );
//remove_action('wpcf7_enqueue_styles');
remove_action( 'wpcf7_enqueue_styles', 'cf7bs_enqueue_styles' );
@andrejIka
andrejIka / gutenberg.txt
Created December 15, 2019 21:45 — forked from chrismccoy/gutenberg.txt
Gutenberg Resources
Extending Gutenberg With SlotFill and Filters
https://10up.com/blog/2019/extending-gutenberg-with-slotfill/
Block Comments swaps out the comment form for a block editor based input
https://tomjn.com/2019/07/20/gutenberg-comments/
How To Remove wp-block-library
https://wpza.net/how-to-remove-wp-block-library-gutenberg/
Add a custom sidebar panel to Gutenberg
@andrejIka
andrejIka / functions.php
Created December 26, 2019 11:24 — forked from jaredatch/functions.php
WordPress Search Autocomplete using admin-ajax.php
<?php
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function ja_global_enqueues() {
wp_enqueue_style(
'jquery-auto-complete',
@andrejIka
andrejIka / mailhog-mamp.md
Created January 11, 2020 07:51 — forked from jaredatch/mailhog-mamp.md
Install MailHog with MAMP Pro

Install MailHog with MAMP Pro, using HomeBrew.

MailHog

First let's make sure HB is updated. Open up terminal for the following steps.

$ brew update

Setting up a WordPress site on AWS

This tutorial walks through setting up AWS infrastructure for WordPress, starting at creating an AWS account. We'll manually provision a single EC2 instance (i.e an AWS virtual machine) to run WordPress using Nginx, PHP-FPM, and MySQL.

This tutorial assumes you're relatively comfortable on the command line and editing system configuration files. It is intended for folks who want a high-level of control and understanding of their infrastructure. It will take about half an hour if you don't Google away at some point.

If you experience any difficulties or have any feedback, leave a comment. 🐬

Coming soon: I'll write another tutorial on a high availability setup for WordPress on AWS, including load-balancing multiple application servers in an auto-scaling group and utilizing RDS.