Skip to content

Instantly share code, notes, and snippets.

@VicVicos
VicVicos / menu.html
Last active October 2, 2018 09:49
Bootstrap Multilevel Menu
<nav id="main-menu" class="navbar navbar-default" role="navigation">
<div class="container">
<div class="row">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
@VicVicos
VicVicos / CFunctions.php
Created December 12, 2017 06:13
Rewrite rule url for custom post type WP and other...
<?php
class CFunctions
{
public function __construct ()
{
add_action('init', [$this, 'rewrite_rule_cpost']);
}
public function rewrite_rule_cpost()
{
@VicVicos
VicVicos / Spoiler.html
Last active March 12, 2019 15:05
Spoler
<div>
<a href="#" class="spoiler-trigger active"><span>Спойлер 1</span></a>
<div class="spoiler-block" style="display:block;">Открытый контент первого спойлера</div>
</div>
@VicVicos
VicVicos / handle_file_upload.php
Created March 29, 2018 02:04 — forked from ebidel/handle_file_upload.php
Uploading files using xhr.send(FormData) to PHP server
<?php
$fileName = $_FILES['afile']['name'];
$fileType = $_FILES['afile']['type'];
$fileContent = file_get_contents($_FILES['afile']['tmp_name']);
$dataUrl = 'data:' . $fileType . ';base64,' . base64_encode($fileContent);
$json = json_encode(array(
'name' => $fileName,
'type' => $fileType,
'dataUrl' => $dataUrl,
@VicVicos
VicVicos / NewPostType.php
Last active September 3, 2020 13:59
New Post type and Taxonomy WP
<?php
class NewPostType
{
const LABEL = 'label';
const LABELS = 'labels';
const VALUE = 'value';
const DESCRIPTION = 'description';
const TYPE = 'type';
const BACK_DOMAIN = 'art-fields';
@VicVicos
VicVicos / grid.css
Created December 4, 2018 04:43
Grid Bootstratp 3
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
@VicVicos
VicVicos / restore_tree.php
Created April 25, 2019 11:23 — forked from max-dark/restore_tree.php
restore tree from table
<?php
/**
* @file https://gist.github.com/max-dark/f39028cc106ed32e8ce1b55a11643b43
*/
define('ROOT_NODE', null);
/**
* восстанавливает дерево по таблице связей
* @param array $data
@VicVicos
VicVicos / .htaccess
Created May 16, 2019 04:42 — forked from Zodiac1978/.htaccess
Make your Website faster - a safe htaccess way
#
# Sources:
# http://stackoverflow.com/questions/7704624/how-can-i-use-gzip-compression-for-css-and-js-files-on-my-websites
# http://codex.wordpress.org/Output_Compression
# http://www.perun.net/2009/06/06/wordpress-websites-beschleuinigen-4-ein-zwischenergebnis/#comment-61086
# http://www.smashingmagazine.com/smashing-book-1/performance-optimization-for-websites-part-2-of-2/
# http://gtmetrix.com/configure-entity-tags-etags.html
# http://de.slideshare.net/walterebert/die-htaccessrichtignutzenwchh2014
# http://de.slideshare.net/walterebert/mehr-performance-fr-wordpress
# https://andreashecht-blog.de/4183/
@VicVicos
VicVicos / js.jquery.js
Created March 7, 2020 15:45
tabs 0.0.9
function tabs() {
$('.tabs-block').on('click', '.nav-link', function (event) {
event.preventDefault();
let $this = $(this),
href = $this.attr('href');
if ($(href).length) {
$('.tabs-link a').removeClass('active');
$this.addClass('active');
$('.tabs-content .tab-content__inner').removeClass('active');
@VicVicos
VicVicos / script.js
Created May 31, 2020 09:30
XHR upload
function upload(url, data) {
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.onload = xhr.onerror = function() {
if (this.status == 200) {
console.log("success");
} else {
console.log("error " + this.status);