Skip to content

Instantly share code, notes, and snippets.

@imgsrc
imgsrc / auto_move.js
Created August 2, 2017 11:37
Вставка из буфера обмена
//Copy Card number to clipboard
function handlePaste(e) {
(e.originalEvent || e).stopPropagation();
(e.originalEvent || e).preventDefault();
var clipboardData = (e.originalEvent || e).clipboardData.getData('text/plain');
var data = clipboardData.match(/.{4}/g);
for (var i= 0; i < data.length; i++) {
$('#pan1').val(data[0]);
$('#pan2').val(data[1]);
$('#pan3').val(data[2]);
@imgsrc
imgsrc / gulpfile.js
Created July 23, 2017 10:11 — forked from agragregra/gulpfile.js
Image Resize + Watermark + Thumbnails
var src = "___library/7-kazan/1/*";
var dst = "_ready";
var gulp = require('gulp'),
imagemin = require('gulp-imagemin'),
cache = require('gulp-cache'),
del = require('del'),
imageResize = require('gulp-image-resize'),
watermark = require("gulp-watermark"),
rename = require("gulp-rename");
@imgsrc
imgsrc / main.js
Created July 5, 2017 14:22
Валидация формы с помощью jquery-validate
$('[type="sending"]').on('click', function (e) {
e.preventDefault();
var formID = $(this).closest('form');
formID.validate({
rules: { name: 'required', phone: 'required'}
});
if (formID.valid()) {
$.post('/lib/Mailer/class.phpmailer.php', formID.serialize());

Font Face

A mixin for writing @font-face rules in SASS.

Usage

Create a font face rule. Embedded OpenType, WOFF2, WOFF, TrueType, and SVG files are automatically sourced.

+font-face(Samplino, fonts/Samplino)
@imgsrc
imgsrc / Replace SVG with inline SVG
Created April 22, 2017 09:52
Replace all SVG images with inline SVG
$('img.img-svg').each(function () {
var $img = $(this);
var imgID = $img.attr('id');
var imgClass = $img.attr('class');
var imgURL = $img.attr('src');
$.get(imgURL, function (data) {
// Get the SVG tag, ignore the rest
var $svg = $(data).find('svg');
// Add replaced image's ID to the new SVG
if (typeof imgID !== 'undefined') {
@imgsrc
imgsrc / migx-sample.js
Created January 30, 2017 18:22 — forked from agragregra/migx-sample.js
MIGX Sample
Tabs:
[
{"caption":"Tab Title", "fields": [
{"field":"title","caption":"Name"},
{"field":"description","caption":"Description","inputTVtype":"textarea"},
{"field":"imageTV","caption":"Photo","inputTV":"imageTV"}
]}
]
Table:
@imgsrc
imgsrc / common.js
Created January 17, 2017 11:30
MobileDetect plugin
var md = new MobileDetect(window.navigator.userAgent);
if(!md.mobile()) {
$('.player').mb_YTPlayer({
videoURL: 'https://youtu.be/-nGuAFKg7FQ',
containment: 'header',
showControls: false,
autoPlay: true,
mute: true,
startAt: 0,
opasity: 1
@imgsrc
imgsrc / common.js
Created January 17, 2017 11:29
WOW animated plugin
var wow = new WOW(
{
boxClass: 'wow',
animateClass: 'animated',
offset: 100, // отступ до элемента, когда будет срабатывать анимация, по умолчанию 0
mobile: false,
live: true
}
);
wow.init();
@imgsrc
imgsrc / common.js
Created January 17, 2017 11:29
Parallax for Stellar
//Parallax for Stellar
$('.parallax').stellar({
verticalOffset: 300,
horizontalScrolling: false,
verticalScrolling: true,
parallaxBackgrounds: true,
offsetParent: true,
backgroundRatio: 2
});
@imgsrc
imgsrc / index.php
Created December 17, 2016 18:42
Wordpress query posts
<?php if ( have_posts() ) : query_posts('p=1');
while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content(); ?>
<?php the_post_thumbnail(array(100, 100)); ?>
<? endwhile; endif; wp_reset_query(); ?>