Skip to content

Instantly share code, notes, and snippets.

View artemrogov's full-sized avatar
🎯
Focusing

Artem Rogov artemrogov

🎯
Focusing
View GitHub Profile
@artemrogov
artemrogov / cascede_migrate
Created April 30, 2016 15:54
каскадное удаление записей из базы
$table->integer('post_id')->unsigned();
$table->foreign('post_id')->references('id')->on('posts')->onDelete('cascade');
@artemrogov
artemrogov / consoleYii.php
Created May 6, 2016 21:25
консольный прогресс бар для YII2
<?php
namespace console\controllers;
use yii\console\Controller;
use yii\helpers\Console;
class ProgressController extends Controller {
public function actionIndex(){
$result = $this->prompt("запуск прогресс бара: ");
@artemrogov
artemrogov / arraymax_min.php
Created May 6, 2016 21:41
максимальный и минимальный элемент массива
<?php
namespace console\controllers;
use yii\console\Controller;
use yii\helpers\Console;
class ArrayController extends Controller {
public function actionIndex(){
$result = array(12,36,45,55,44,122,5,2,7);
@artemrogov
artemrogov / threejsCubeAnimation.js
Created May 7, 2016 15:06
создание простейшего анимационного примитива
var canvas = document.getElementById('canvas');
var width = canvas.width;
var height = canvas.height;
var renderer = new THREE.WebGLRenderer({canvas:canvas});
renderer.setClearColor(0xFFFFFF);
//создание сцены:
@artemrogov
artemrogov / fabrica.php
Last active May 10, 2016 19:34
Паттерны проектирования Фабрика
/* фабрика */
class Auto {
private $_make;
private $_model;
public function __construct($make, $model){
$this->_make = $make;
$this->_model = $model;
}
public function getMakeModel(){
@artemrogov
artemrogov / binding.php
Last active May 16, 2016 18:01
BindingClassLaravel5.2
interface BarInterface {
}
class Bar implements BarInterface
{
}
App::bind('BarInterface','bar');
@artemrogov
artemrogov / calc.c
Last active September 22, 2016 14:23
приметивный калькулятор на си, для Кости
#include<stdio.h> //библиотека ввода/вывода
//#include<stdlib.h> // библиотека для функции getchar() для линукца
#include<conio.h>
//
int main(){
int n,a,b,result;
char opt;
do {
printf("колавиша 1: сложение\n");
@artemrogov
artemrogov / factory.php
Created October 8, 2016 22:58
Laravel: Создание фабрик автозаполнения тестировочными данными - фабрики
$factory->define(App\Post::class, function (Faker\Generator $faker) {
return [
'title' => $faker->title,
'body' => $faker->paragraph(10),
'user_id'=>function () {
return factory(App\User::class)->create()->id;
}
@artemrogov
artemrogov / create_migration_tb.php
Created January 19, 2018 08:17
create_migration_tb
Schema::create('pages', function (Blueprint $table) {
$table->increments('id');
$table->string('name_page');
$table->string('meta_k');
$table->string('meta_d');
$table->text('content');
$table->integer('category_id')->unsigned();
$table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
$table->timestamps();
});
@artemrogov
artemrogov / forms_inject.blade.php
Created January 21, 2018 13:49
Laravel forms inject
@inject('obj', 'App\КлассМодели::СататическийМетод')