Skip to content

Instantly share code, notes, and snippets.

View panayotoff's full-sized avatar

Chris panayotoff

View GitHub Profile
@panayotoff
panayotoff / anyrest.php
Created October 22, 2018 11:08
Simple rest controller to get page by slug
<?php
/**
* @package Any_Rest
* @version 1.7
*/
/*
Plugin Name: Any Rest
Description: Get any page by slug
Usage: http://test1.localhost/wp-json/anyrest/v2/apt?slug=hello-world
@panayotoff
panayotoff / MquDOM.js
Created October 20, 2018 19:07
Mqu.js DOM helpers
// shorthand helpers
export const html = document.documentElement;
export const body = document.body;
export const el = (e, p = document) => p.querySelector(e);
export const els = (e, p = document) => Array.prototype.slice.call(p.querySelectorAll(e));
export const onLoad = cb => document.addEventListener('DOMContentLoaded', cb, false);
export const isArray = obj => (Object.prototype.toString.call(obj).toLowerCase().indexOf('array') >= 0);
export const isArrayLike = obj => {
[
{
"block":"Basic Latin",
"range":"0000-007F",
"low":"0000",
"high":"007F"
},
{
"block":"Latin-1 Supplement",
"range":"0080-00FF",
export default class Component {
constructor(element, options) {
this.element = element;
this.element['__component__'] = this;
this.options = {...options, ...parseOptions(this.element)};
}
el(s) {return el(s, this.element)}
els(s) {return els(s, this.element)}
init() {}
destroy() {}
const a = new AudioContext();
const oo = a.createOscillator();
oo.connect(a.destination);
oo.type="square";
oo.start();
window.addEventListener("mouseover", e => oo.frequency.linearRampToValueAtTime(e.target .innerHTML.length * 0.1 + 37, a.currentTime + 0.37));
@panayotoff
panayotoff / wp-laravel-mix.config.js
Last active January 21, 2019 12:22
Laravel Mix wordpress config
// File webpack.mix.js
const mix = require('laravel-mix');
const PATHS = {
src: 'src',
dist: '.',
proxy: 'http://localhost:8888/project'
};
@panayotoff
panayotoff / MquScroll.js
Last active September 3, 2018 08:42
MquScroll - JS util for creating scrolling animations
var MquScroll = function(options) {
//--------------------------------------------------------------
// Compatibility
//--------------------------------------------------------------
var raf = window.requestAnimationFrame || window.webkitRequestAnimationFrame || function(callback) {
window.setTimeout(callback, 1000 / 60)
};
var passiveSupported = false;
@panayotoff
panayotoff / Dynamo.js
Last active May 14, 2018 08:37
Simple VueJS Dynamic component
export default {
name : 'Dynamo',
functional: true,
props : {
template: String
},
render(createElement, context)
{
context.parent.$once('hook:mounted', () => {
context.parent.$forceUpdate()
@panayotoff
panayotoff / GSAPSimple.js
Created March 17, 2018 22:52
Simple GSAP fade-in fade-out transition as a VueJS Component
import TweenLite from 'gsap/TweenLite';
import CSSPlugin from 'gsap/CSSPlugin';
/*
* The GSAP-Simple transition is not used, but keep it as a template
* Author: Chris Panayotoff chris@onload.agency
* */
import Vue from 'vue';
@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) {