Skip to content

Instantly share code, notes, and snippets.

View panayotoff's full-sized avatar

Chris panayotoff

View GitHub Profile
@panayotoff
panayotoff / DragSlides.js
Last active March 7, 2018 10:21
Infinite GSAP draggable slider
(function ($, window, undefined) {
var App = (window.App === undefined) ? (window.App = {}) : window.App;
(App.Views === undefined && (App.Views = {}));
App.Views.DragSlides = Backbone.View.extend({
el: '.dragslides',
initialize: function () {
if (!this.$el.length) {
[
"",
"1, улица",
"2, улица",
"3, улица",
"4, улица",
"5, улица",
"6, улица",
"7, улица",
"8, улица",
@panayotoff
panayotoff / slugify.js
Created January 24, 2018 11:16
Slugify
export default function slugify(text) {
const a = 'àáäâèéëêìíïîòóöôùúüûñçßÿœæŕśńṕẃǵǹḿǘẍźḧ·/_,:;';
const b = 'aaaaeeeeiiiioooouuuuncsyoarsnpwgnmuxzh------';
const p = new RegExp(a.split('').join('|'), 'g');
/* eslint-disable */
return text
.toString()
.toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
@panayotoff
panayotoff / Gulpfile.js
Created September 26, 2017 20:57
Example Gulp config for working with WP themes;
/*
Package.json
{
"name": "gulpdev",
"version": "0.0.1",
"description": "",
"main": "index.php",
"scripts": {
"dev": "gulp"
@panayotoff
panayotoff / stinky_wc.php
Created September 19, 2017 12:51
WooCommerce - list of latest products
<?php
$args = array(
'post_type' => 'product',
'stock' => 1,
'posts_per_page' => 4,
'orderby' => 'date',
'order' => 'DESC'
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
import {TRACKING_ID} from '../appConfig';
import store from '../store/store';
let gaAvailable = false;
let ga = null;
const loadAnalytics = () => {
const isPageSpeedBot = (navigator.userAgent.indexOf('Speed Insights') !== -1);
const blockTracking = store.getters.track.toString() === 'false';
if (blockTracking || isPageSpeedBot) {
(function(window){
const mediaRegex = /img|video/gi;
const linkStyles = {
display: 'inline-block',
padding: '5px 10px',
backgroundColor: '#ffffff',
color: '#262626',
fontWeight: '600',
cursor: 'pointer',
//Test if the PWA is running in standalone mode
window.matchMedia( '(display-mode: standalone)' ).matches
@panayotoff
panayotoff / firebaseUtils.js
Created January 13, 2017 13:47
ES6 firebase object to array
/*
* Converts firebase object to Array;
* Each object from the array will contain 'key' property,
* corresponding to the firebase key
* */
const toArray = function (firebaseObj) {
return Object.keys(firebaseObj).map((key)=> {
return Object.assign(firebaseObj[key], {key});
'use strict';
window._ = {};
_.templateSettings = {
evaluate: /<%([\s\S]+?)%>/g,
interpolate: /<%=([\s\S]+?)%>/g,
escape: /<%-([\s\S]+?)%>/g
};