Skip to content

Instantly share code, notes, and snippets.

Pavel Volyntsev pvolyntsev

View GitHub Profile
@pvolyntsev
pvolyntsev / colorPicker.js
Last active Mar 16, 2017
Vue + WordPress + wpColorPicker
View colorPicker.js
Vue.component('colorPicker', {
props: ['value'],
template: '<input type="text">',
mounted: function () {
var vm = this;
$(this.$el)
.val(this.value)
// WordPress color picker
.wpColorPicker({
defaultColor: this.value,
View app.py
# -*- coding: UTF-8 -*-
from flask import Flask, request, render_template, jsonify
from flaskext.mysql import MySQL
from flask_cors import CORS, cross_origin
from pymysql.cursors import DictCursor
import json
app = Flask(__name__)
@pvolyntsev
pvolyntsev / nginx.conf
Created Sep 8, 2016 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
View nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@pvolyntsev
pvolyntsev / application.php
Last active Jun 6, 2016
Пример кода, реализующего логику гибкого роутинга HTTP запросов
View application.php
<?php
/**
* Пример набора классов для демонстрации роутинга с помощью набора роутеров
*/
/**
* Статический роутер, умеет проверять URI на полное совпадение с одним из элементов списка путей
*/
class StaticRouter implements RouterInterface
{
View question-188209129.php
<?php
/**
* Ответ на вопрос https://otvet.mail.ru/question/188209129
*/
$arr = array(1,2,3,0,4,5,6,0,8,9,10); // твой массив
$valueToFind = 0; // значение, которое надо найти
$valueFound = false; // найдено ли искомое значение
$sum = 0;
foreach($arr as $element)
{
View question-188212525.php
<?php
/**
* Ответ на вопрос https://otvet.mail.ru/question/188212525
*/
$arr = array(1,2,3,0,4,5,6,0,8,9,10); // твой массив
$arr = array_reverse($arr);
$sum = 0;
foreach($arr as $element)
@pvolyntsev
pvolyntsev / feedback.html
Last active Jun 6, 2016
Отправка формы посредством AJAX и PHP
View feedback.html
<div class="b-form-wrap">
<p id="validation-fail-msg">Please, fill in the missing fields.</p>
<form novalidate id="feedback-form">
<div class="b-form-box">
<p class="form-box__text form-box__text_no-pad">What's your name?<sup class="form-box__sup">*</sup></p>
<input type="text" name="name" maxlength="30" required id="name-input" class="form-box__input-field">
<p class="form-box__text">What's your phone number?<sup class="form-box__sup">*</sup></p>
<input type="text" name="phone" maxlength="30" required id="phone-input" class="form-box__input-field">
<p class="form-box__text">What's your email?<sup class="form-box__sup">*</sup></p>
<input type="text" name="email" maxlength="50" required id="email-input" class="form-box__input-field">
@pvolyntsev
pvolyntsev / what-forces-layout.md
Created Oct 7, 2015 — forked from paulirish/what-forces-layout.md
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Element

Box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
  • elem.clientLeft, elem.clientTop, elem.clientWidth, elem.clientHeight
  • elem.getClientRects(), elem.getBoundingClientRect()
@pvolyntsev
pvolyntsev / LazyHttpSession.php
Last active Sep 15, 2015
Yii HTTP Sessions component with logic "Suppress PHP Session"
View LazyHttpSession.php
<?php
/**
* Class LazyHttpSession
* Обеспечивает подавление создания сессий PHP
*
* @author pavel.volyntsev@gmail.com
* @link http://copi.st/nMen
*/
class LazyHttpSession extends CCacheHttpSession // здесь надо указать супер-класс, используемый в твоём приложении
You can’t perform that action at this time.