Skip to content

Instantly share code, notes, and snippets.

View anton-kotik's full-sized avatar

Anton Kotik anton-kotik

View GitHub Profile
@anton-kotik
anton-kotik / zf2-sql-examples.php
Last active November 13, 2022 18:54
Zend Framework 2 database SQL examples
<?php
use Zend\Db\Sql\Expression;
use Zend\Db\Sql\Predicate\Operator;
use Zend\Db\Sql\Select;
use Zend\Db\Sql\Where;
use Zend\Db\TableGateway\TableGateway;
$adapter = $this->getServiceLocator()->get('Zend\Db\Adapter\Adapter');
$table = new TableGateway('users', $adapter);
@anton-kotik
anton-kotik / php-class-template.php
Last active August 22, 2016 00:34
Simple PHP class template
<?php
namespace Application\Component\Example;
use Traversable;
use Exception as PhpException;
use Application\Component\Exception;
use Zend\Stdlib\ArrayUtils;
@anton-kotik
anton-kotik / mkvhost.sh
Last active October 12, 2015 04:33
Add/remove virtual host
#!/bin/bash
# @link http://habrahabr.ru/post/93695/
# @link https://gist.github.com/jasonlewis/6291983
# @link https://github.com/RoverWire/virtualhost/blob/master/virtualhost.sh
# @link http://www.sebdangerfield.me.uk/2011/03/automatically-creating-new-virtual-hosts-with-nginx-bash-script/
# @link https://coderwall.com/p/cqoplg/bash-script-to-create-new-apache2-virtual-hosts
domain=$1
user=georgy
group=georgy
@anton-kotik
anton-kotik / html-meta.md
Created September 12, 2015 13:15
List of Usable HTML Meta and Link Tags

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
<meta name='language' content='ES'>
@anton-kotik
anton-kotik / logo.md
Created December 21, 2015 17:31
Logo
@anton-kotik
anton-kotik / functions.php
Created April 8, 2016 19:09
PHP Functions Rating
86937 isset
43159 echo
31697 empty
29252 substr
26146 count
24248 is_array
22572 strlen
19365 sprintf
18090 unset
16584 str_replace
@anton-kotik
anton-kotik / jquery.plugin.js
Created September 22, 2016 05:04
jQuery Plugin Template
/**
* jQuery Plugin Template
*
* @see http://stefangabos.ro/jquery/jquery-plugin-boilerplate-revisited/
*/
!(function($) {
'use strict';
$.pluginName = function (element, options) {
// plugin's default options
@anton-kotik
anton-kotik / mixins.less
Last active October 13, 2016 03:50
Less Mixins
/**
* Текст с многоточием.
*/
.text-overflow
{
display: block;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@anton-kotik
anton-kotik / README.md
Last active March 4, 2018 21:14
PHP migrations
  • Не использовать IF NOT EXISTS;
  • Вместо id называть ключи table_name_id;
  • LOCK=NONE для больших таблиц не работает, выкатывать изменения в таких таблицах только ночью с deploy-lock;
@anton-kotik
anton-kotik / dv-form-template.php
Last active March 28, 2017 12:13
DV Form Template
<?php
use Dostavista\Framework\Form\FormAbstract;
use Zend_Form_Decorator_Label;
/**
* @property Zend_Form_Element_Text $text_field_name
*/
class TemplateForm extends FormAbstract {
/**