Skip to content

Instantly share code, notes, and snippets.

@7iomka
7iomka / mixItUp_filter_hash.js
Created October 4, 2016 13:55 — forked from unconditional/mixItUp_filter_hash.js
mixItUp_filter_hash.js
jQuery(document).ready(function(){
if (window.location.hash) {
var hashdata = new Object();
jQuery.each(window.location.hash.replace(/^#/,'').split('&'), function(i, t){
var s = t.split('=');
hashdata[s[0].toLowerCase()] = s[1].toLowerCase();
});
var $filters = jQuery('div[id^="Filters"]').find('li');
@7iomka
7iomka / gist:4a12ec792a164d76108a08166d8b66da
Created October 17, 2016 13:42 — forked from chad3814/gist:2924672
deleting array items in javascript with forEach() and splice()
// This is from my comment here: http://wolfram.kriesing.de/blog/index.php/2008/javascript-remove-element-from-array/comment-page-2#comment-466561
/*
* How to delete items from an Array in JavaScript, an exhaustive guide
*/
// DON'T use the delete operator, it leaves a hole in the array:
var arr = [4, 5, 6];
delete arr[1]; // arr now: [4, undefined, 6]
@7iomka
7iomka / gist:bb9572b9a9497f07032018da4c9da721
Last active May 14, 2019 21:08
.Htaccess Optimize SiteSpeed
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 year"
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
@7iomka
7iomka / gist:3b8d04d7922f42e8c3c68868091bac4e
Last active October 31, 2016 18:47
SETTINGS FOR ALL FORMS INSIDE REMODA
/********************************** SETTINGS FOR ALL FORMS INSIDE REMODAL *************************************/
$(document).on('opening', '.remodal', function(e) {
// $(e.target).hasClass('remodal--action');
});
$('.remodal--action').each(function() {
var $context = $(this),
$form = $(this).find('form'),
$form_id = $context.data('remodal-id');
$form.submit(function(e) {
@7iomka
7iomka / modal.html
Created November 10, 2016 21:23 — forked from koistya/modal.html
Modal dialog with a YouTube player
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
<script src="http://code.jquery.com/jquery.min.js"></script>
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
</head>
<body>
@7iomka
7iomka / basic.html
Created November 20, 2016 16:58 — forked from AlbinoShaun/basic.html
OpenSeadragon viewer and navigator with resize handles
<!DOCTYPE html>
<html>
<head>
<title>OpenSeadragon Basic Demo</title>
<script type="text/javascript" src='../../build/openseadragon/openseadragon.js'></script>
<script type="text/javascript" src='../lib/jquery-1.9.1.min.js'></script>
<script type="text/javascript" src='../lib/jquery-ui-1.10.2/js/jquery-ui-1.10.2.min.js'></script>
<link rel="stylesheet" href="../lib/jquery-ui-1.10.2/css/smoothness/jquery-ui-1.10.2.min.css" />
<style type="text/css">
@7iomka
7iomka / index.html
Created January 21, 2017 22:04 — forked from jinkrish/index.html
jQuery plugin
<html>
<head>
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
</head>
<body>
<div id="mydiv" ></div>
<script src="jquery.myplugin.js" ></script>
<script>
$("#mydiv").myplugin({
debug: true,
@7iomka
7iomka / yandex-map-list.js
Created February 4, 2017 11:48
Yandex map list adress with click and focus
/* Start:"a:4:{s:4:"full";s:60:"https://kankan.ru/local/js/controllers/partials/yandex-map.js?148514742316146";s:6:"source";s:44:"/local/js/controllers/partials/yandex-map.js";s:3:"min";s:0:"";s:3:"map";s:0:"";}"*/
(function($, APP) {
'use strict';
/**
* Контроллер Яндекс Карты
**/
APP.Controls.YandexMap = can.Control.extend({
defaults: {
coords: [55.76, 37.64],
myMap = new ymaps.Map('filial-map', {
// При инициализации карты обязательно нужно указать
// её центр и коэффициент масштабирования.
center: [51.315394, 44.391984],
zoom: 5
//controls: ['zoomControl', 'typeSelector']
});
var zoomControl = new ymaps.control.ZoomControl({
options: {
@7iomka
7iomka / remove-empty-p.php
Created April 27, 2017 18:01 — forked from ninnypants/remove-empty-p.php
Remove empty p tags from WordPress posts
<?php
add_filter( 'the_content', 'remove_empty_p', 20, 1 );
function remove_empty_p( $content ){
// clean up p tags around block elements
$content = preg_replace( array(
'#<p>\s*<(div|aside|section|article|header|footer)#',
'#</(div|aside|section|article|header|footer)>\s*</p>#',
'#</(div|aside|section|article|header|footer)>\s*<br ?/?>#',
'#<(div|aside|section|article|header|footer)(.*?)>\s*</p>#',
'#<p>\s*</(div|aside|section|article|header|footer)#',