Skip to content

Instantly share code, notes, and snippets.

View andrejIka's full-sized avatar

Andrej B. andrejIka

View GitHub Profile
@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 / 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 / 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 / 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%;
// 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 / Free O'Reilly Books.md
Created February 24, 2019 18:44 — forked from augbog/Free O'Reilly Books.md
Free O'Reilly Books

Free O'Reilly books and convenient script to just download them.

Thanks /u/FallenAege/ and /u/ShPavel/ from this Reddit post

How to use:

  1. Take the download.sh file and put it into a directory where you want the files to be saved.
  2. cd into the directory and make sure that it has executable permissions (chmod +x download.sh should do it)
  3. Run ./download.sh and wee there it goes. Also if you do not want all the files, just simply comment the ones you do not want.
@andrejIka
andrejIka / WordPress Standalone PHP
Created February 7, 2019 12:25 — forked from karlazz/WordPress Standalone PHP
Running WordPress functions as a standalone php file
<!DOCTYPE HTML>
<!-- attribution -- this blog provided the code
http://blog.makingsense.com/2011/03/create-stand-alone-web-pages-or-widgets-that-use-wordpress-functions/
-->
<?php
//required include files
require('wp-blog-header.php');
require_once("wp-config.php");
require_once("wp-includes/wp-db.php");
@andrejIka
andrejIka / osx_setup.md
Created December 21, 2018 06:32 — forked from mcls/osx_setup.md
Setup mac for ruby dev
@andrejIka
andrejIka / README.md
Created December 21, 2018 06:30 — forked from ngryman/README.md
intellij javascript live templates

intellij javascript live templates

Just a dump of handy live templates I use with IntelliJ. They should also work with WebStorm.

How to

  • Go to settings.
  • Search for live templates.
  • Under the javascript section you should be able to manage your templates.