Skip to content

Instantly share code, notes, and snippets.

View ekwoster's full-sized avatar
🇺🇦

Yevhen Kozachenko ekwoster

🇺🇦
View GitHub Profile
@ekwoster
ekwoster / force_vue3_devtools.js
Last active February 20, 2023 19:23
Vue3 force vue.tools on prod
const app = Array.from(document.querySelectorAll('*')).find((e) => e.__vue_app__).__vue_app__
const version = app.version
const devtools = window.__VUE_DEVTOOLS_GLOBAL_HOOK__
devtools.enabled = true
devtools.emit('app:init', app, version, {})
/** Source: https://mokkapps.de/vue-tips/force-enable-vue-devtools-in-production-build/ */
/** After this code press Option+R on Mac */
@ekwoster
ekwoster / customroutes.php
Created December 17, 2021 17:15 — forked from samhernandez/customroutes.php
A simple class to add custom routes to Wordpress.
<?php
/**
* NOTE: This gist is very old. You might want to check out recent forks
* like this one: https://github.com/Alexlytle/Wordpress_custom_route/blob/main/Wordpress_Custom_route.php
* (thanks @Alexlytle) If you have an improvement to this gist, please
* post a link in a comment for others who might benefit. Thanks!
*
* A class to create simple custom routes.
*
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:-//Dodel Bookings//Dodel Booking WP 1.0//RU
BEGIN:VEVENT
LOCATION:Dnipro
SUMMARY:Бронь комнаты Миссия выполнима (10-16) 06.0
UID:625-1525369848
DTSTART;TZID=Europe/Kiev:20180506T110000
DTEND;TZID=Europe/Kiev:20180506T123000
@ekwoster
ekwoster / unhash.js
Created March 2, 2018 20:21
Remove hash with # from window.location.hash
function unhash () {
var sy, sx;
if ("pushState" in history)
history.pushState(
"", document.title,
window.location.pathname + window.location.search
);
else {
// сохраняем позицию прокрутки страницы в переменные
sy = document.body.scrollTop;
fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
jQuery('header').bind('classChanged', function(){
console.log('class changed');
});
@ekwoster
ekwoster / jquery.classChanged.event.js
Created June 29, 2017 09:43
jQuery Class Changed Event
(function(){
var originalAddClassMethod = jQuery.fn.addClass;
var originalRemoveClassMethod = jQuery.fn.removeClass;
jQuery.fn.addClass = function(){
var result = originalAddClassMethod.apply( this, arguments );
jQuery(this).trigger('classChanged');
return result;
}
jQuery.fn.removeClass = function(){
var result = originalRemoveClassMethod.apply( this, arguments );