Skip to content

Instantly share code, notes, and snippets.

@yesnik
yesnik / ubuntu.md
Last active August 4, 2018 11:49
Ubuntu Vurtualbox screen noise during installation

Ubuntu Vurtualbox screen noise during installation

I tried to install Ubuntu 18 on my Windows 10 PC using Virtualbox.

I saw problem with screen when I selected "Install Ubuntu on PC" item on the installation menu.

Solution: Just press this combinations of keys on your keyboard:

  1. Ctrl + Alt + F1
  2. Ctrl + Alt + F7

Capybara Methods

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'Place order'
@yesnik
yesnik / delivery.js
Created November 16, 2017 06:57
Jquery modules
// We need to understand how to organise this piece of code better
var Delivery = (function () {
var selectedCityName,
$textDelivery,
$textNoDelivery;
function init() {
initElements();
initVars();
@yesnik
yesnik / laravel_documentation.md
Last active February 10, 2020 21:47
Laravel рецепты

Команды консоли

Модель

Создать модель и файл миграции

php artisan make:model Book -m

Будет создано 2 файла:

@yesnik
yesnik / visibility_modifiers.md
Last active September 15, 2017 06:29
PHP OOP details

PHP Visibility Modifiers

Protected static functions

class Hello {
    
    public static function greet($name) {
        return self::getMessage($name);
 }
@yesnik
yesnik / active_record.md
Last active November 1, 2024 14:49
Yii 1 Framework Cookbook

CActiveRecord methods

findAll()

Sort records

// Ascending order
Partner::model()->findAll(array('order' => 'company'));
@yesnik
yesnik / seller_plan_report.sql
Created March 23, 2017 13:56
SQL-запрос отчета
WITH accessible_users AS (
SELECT DISTINCT public.users.* FROM public.users WHERE
public.users.id IN (50034, 33322, 11233)
)
SELECT
1 AS condition,
MAX(ac.title) AS accounting_center, -- Центр учета
MAX(users.name) AS seller, -- Продавец
MAX(clients.id) AS client_id, -- ИД Клиента
MAX(clients.title) AS client_title, -- Наименование клиента
@yesnik
yesnik / service_base_example.rb
Last active November 1, 2016 12:22
Базовый класс сервиса
# Базовый класс, от которого наследуются все сервисы
class ServiceBase
attr_reader :data
class << self
def call(data)
instance = new(data)
instance.call
instance
end
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
UNICORN_GROUP=${UNICORN_GROUP:-${UNICORN_USER}}
UNICORN_CONFIGFILE=${UNICORN_CONFIGFILE:-/etc/unicorn/${RC_SVCNAME}.conf.rb}
command=${UNICORN_BINARY:-/usr/bin/unicorn_rails}
command_args="${UNICORN_ARGS:--E production} -D -c ${UNICORN_CONFIGFILE}"
pidfile=${UNICORN_PIDFILE:-/var/run/${RC_SVCNAME}/unicorn.pid}
#start_stop_daemon_args="--user ${UNICORN_USER} --env GEM_HOME=/home/dk/.gem/ruby/1.9"
@yesnik
yesnik / response_example.rb
Created October 21, 2015 12:01
Ruby on Rails request.env variable content
# This is the content of variable request.env
# We get this content in controller:
# class BlogsController < ApplicationController
# def index
# render plain: "Response: #{ YAML::dump(request.env) }"
# end
# end