Skip to content

Instantly share code, notes, and snippets.

View AnatoliyAkhmatov's full-sized avatar
♣️

Anatoliy AnatoliyAkhmatov

♣️
View GitHub Profile
window.onLeave = (f, single = false) => {
var showed = false
var fn = () => {
if (single ? !showed : true) {
if (single) showed = true;
f()
}
}
/**
* Remove the slug from published post permalinks for our custom post types.
*/
add_filter( 'post_type_link', function( $post_link, $post, $leavename ) {
$post_types = array(
'projects',
'catalog',
var showed = false
window.addEventListener('mouseout', e => {
if (!showed && (e.pageX < 1 || e.pageY < 1)) {
showed = true
//
}
})
backdrop-filter: blur(20px)
box-shadow: 0 1px 24px -1px rgba(#fff, .1)
@import '../node_modules/swiper/swiper.scss'
@import '../node_modules/swiper/components/navigation/navigation.scss'
// @import '../node_modules/swiper/components/pagination/pagination.scss'
// @import '../node_modules/swiper/components/lazy/lazy.scss'
import SwiperCore, { Navigation } from 'swiper'; share(SwiperCore, 'Swiper')
Swiper.use([Navigation])
Object.keys((new $).__proto__).forEach(el => {
try {
if (!HTMLElement.prototype[el]) {
HTMLElement.prototype[el] = function() {
let e = $(this)
return e[el].apply(e, arguments)
}
}
} catch(e) {}
})
DB::getPdo()->lastInsertId();
<?php
// https://forums.modx.com/thread/74440/problem-with-creating-modresource-programmatically
$page = $modx->newObject('modResource');
$page->set('createdby', $modx->user->id);
$page->set('createdon', time());
$page->set('parent', 3);
$page->set('template', $templateId);
$page->set('alias', $page->cleanAlias($rq['pagetitle']));
// $page->set('uri', $page->cleanAlias($rq['pagetitle']).".html");
window.stick = (el, top_el = null, bottom_el = null) => {
var parent = el.parentNode
if (!top_el) top_el = parent
if (!bottom_el) bottom_el = parent
window.addEventListener('scroll', debounce(() => {
var top = window.pageYOffset
var bottom_stop = $(bottom_el).offset().top
var top_stop = $(top_el).offset().top
$args = array(
'container' => '',
'theme_location'=> 'your-theme-loc',
'depth' => 1,
'fallback_cb' => false,
'add_li_class' => 'your-class-name1 your-class-name-2'
);
wp_nav_menu($args);