Skip to content

Instantly share code, notes, and snippets.

Avatar

Stanislav Khromov khromov

View GitHub Profile
@khromov
khromov / README.md
Last active Sep 20, 2020
docker-compose file for phpMyAdmin and MySQL
View README.md
@khromov
khromov / polylang-multilingual-sitemap.php
Last active Sep 15, 2020
Multilingual Polylang sitemaps for "XML Sitemap & Google News" plugin
View polylang-multilingual-sitemap.php
<?php
/**
* Plugin Name: Multilingual Polylang sitemaps for "XML Sitemap & Google News" plugin
* Description: For https://wordpress.org/plugins/xml-sitemap-feed/
* Version: 1.0
*/
add_action('xmlsf_tags_after', function () { // xmlsf_tags_after
//Bail early.
if (!function_exists('pll_languages_list')) {
View functions.php
<?php
// Your themes functions.php
add_action( 'init', function() {
add_rewrite_rule(
'recipe/([0-9]+)/?$',
'index.php?pagename=recipe&recipe_id=$matches[1]',
'top' );
});
View built-share-[id].js
(window.webpackJsonp = window.webpackJsonp || []).push([
[21], {
"+51p": function(t, n, e) {
"use strict";
e.r(n), e.d(n, "__N_SSP", (function() {
return m
}));
var o = e("q1tI"),
r = e.n(o),
c = e("8Kt/"),
@khromov
khromov / PWAOfflineStatus.js
Last active Jul 26, 2020
React Progressive Web App Online / Offline warning message hook
View PWAOfflineStatus.js
import React, { useState, useEffect } from 'react';
function PWAOfflineStatus(props) {
const [isOnline, setOnlineStatus] = useState(true);
// https://stackoverflow.com/questions/44756154/progressive-web-app-how-to-detect-and-handle-when-connection-is-up-again
useEffect(() => {
const setFromEvent = function(event) {
if(event.type === 'online') {
setOnlineStatus(true);
@khromov
khromov / README.md
Last active May 16, 2020
Migrate an Amazing Marvin list to Wallabag
View README.md

Migrate an Amazing Marvin reading list to Wallabag

Example: You've been using the Amazing Marvin Bookmarklet and now the tasks have piled up and Marvin is acting sluggish. Wallabag is a prefect place to migrate these bookmarks.

Prerequisites

  • PHP 7
  • Python 3

Process

  • Export one or more of your reading lists containings URLs from Amazing Marvin by going to Account > Backups > Backup.
@khromov
khromov / wp-config.php
Last active Oct 1, 2019
Convert MySQL connection string to wp-config.php parameters
View wp-config.php
<?php
//...
// This will usually be received from an env variable, for example $connectionString = getenv('DB_URL');
$connectionString = 'mysql://user:password@foo-bar.rds.amazonaws.com:3306/database';
// The values below will be your default values if $connectionString is empty.
$dbConfig = array_merge(
[
'host' => 'localhost',
@khromov
khromov / README.md
Created Jul 12, 2019
Amazing Marvin webhook
View README.md

Webhook for Amazing Marvin

In order for this to work you need to fetch your Zapier token from Marvin Settings > Strategies > Zapier integration > Settings.

However, you don't actually need a Zapier for this to work, just send the request from your favourite framework.

@khromov
khromov / fix-broken-instagram.php
Last active Mar 1, 2018
Fix broken / overlapping Instagram embed for WordPress
View fix-broken-instagram.php
<?php
/**
* Plugin Name: Fix broken Instagram oEmbed
* Description: Fixes an issue with Instagram posts being broken when multiple posts are oEmbedded.
* Version: 1.0
* Author: khromov
*/
/**
* Remove Instagram embed.js script on each embed
@khromov
khromov / infogram-oembed.php
Created Oct 19, 2017
Infogram oEmbed plugin
View infogram-oembed.php
<?php
/*
Plugin Name: Infogram oEmbed
Plugin URI:
Description: Adds oEmbed support for infogr.am and infogram.com urls.
Author: khromov
Version: 1.0
Author URI: https://khromov.se
*/
You can’t perform that action at this time.