Skip to content

Instantly share code, notes, and snippets.

View panayotoff's full-sized avatar

Chris panayotoff

View GitHub Profile
<?php
/**
* @package SPA_Sections
* @version 1.0
*/
/*
Plugin Name: SPA Sections
Description: Adding navigations to SPA sections
Author: Chris Panayotoff
Version: 1.0
@panayotoff
panayotoff / pre.php
Last active January 10, 2019 12:42
Helper to pretty output variable
function pre($var){
$styles = [
'display:block',
'padding:1em',
'margin:1em',
'border-radius:3px',
'font-size:14px',
'font-family: monospace',
'white-space: pre-wrap',
'word-wrap: break-word',
<?php
/*
* Return the asset path as variable
* */
function get_asset($url)
{
return get_template_directory_uri() . '/assets/' . $url;
}
/*
@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 / 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()