Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / laravel_documentation.md
Last active February 10, 2020 21:47
Laravel рецепты

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

Модель

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

php artisan make:model Book -m

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

@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();

Capybara Methods

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'Place order'
@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
@yesnik
yesnik / docker-compose.md
Last active March 25, 2025 13:24
Docker Guides

Docker Compose

Docker compose is a tool that is used for defining and running multi-container Docker apps in an easy way. It provides docker-compose.yml configuration file that can be used to bring up an app and the suite of services it depends on with just one command.

  • docker compose up - start all services from docker-compose.yml
  • docker compose up db - start only service db
  • docker compose up --build - rebuild all images and run containers
  • docker compose restart db - restart db service
@yesnik
yesnik / software_modification.md
Last active January 25, 2021 18:11
How to modify logic of software

How to modify logic of software

You have a client with a website. Client wants to add new feature or fix some bug.

Initial analysis

  • Listen carefully what client needs

  • Describe current logic that we need to modify. If logic is complex draw scheme on the sheet of paper. Don't describe details yet, forget about table names, class' names on this step.

@yesnik
yesnik / sheldon_crm_tasks.md
Last active June 3, 2019 09:46
Tasks for creating Sheldon CRM

Sheldon CRM Tasks

Dear programmer, I need your help to build a simple CRM named Sheldon CRM. Here you can find tasks that will help us to create it. You can use any programming language you want. All I want is a website with my Sheldon CRM.

1. Store partners

I have several partners. On our CRM website I need a page for creating new partners. Each partner has name and email. Also I need a page for editing each partner's information and a page where I can browse all partners' info.

@yesnik
yesnik / UniqueProcess.php
Created September 6, 2019 09:35
PHP Unique process
<?php
/**
* This class allows us to run only one instance of the process
*
* Example:
*
* $uniqueProcess = new UniqueProcess('/var/tmp/some_process_name.lock');
* if (!$uniqueProcess->begin()) {
* die();