Skip to content

Instantly share code, notes, and snippets.

View exileed's full-sized avatar
🎵
NP: North Star of Nija (Orbit Culture) (3:25/5:14)

Dmitriy Kuts exileed

🎵
NP: North Star of Nija (Orbit Culture) (3:25/5:14)
View GitHub Profile
@exileed
exileed / index.php
Last active September 19, 2017 00:35
<?php
class Vk {
private $vk;
private $owner;
public function __construct( vk $vk, $user = null, $group = null ) {
$this->vk = $vk;
if ( ! $user && ! $group ) {
<?php
class Connect {
private $connection;
public function __construct(){
$this->connect();
}
public function connect(){
@exileed
exileed / StaInstall.php
Last active January 11, 2018 01:51
Code Class
<?php
/*
* Название класса не по psr1,psr-2, -> StaInstall
* Сама по себе реализация спорная.
* Тут 2 варианта идти по пути фреймворков (пользователя сами настраивают ) или все делает движок.
* в случае движка. мы должны не создавать новый файл конфигураций. я копировать config.demo.php в config.php, и уже там менять параметры.
* Прст, завтра мы захотим еще что-то там хранить. что будет тогда ?
*/
<?php
$user_id = $_SESSION['user']['id'];
$STH = $pdo->query ( "SELECT * FROM dialog WHERE recive = $user_id OR send = $user_id ORDER by id DESC" );
$STH->setFetchMode ( PDO::FETCH_OBJ );
$row = $STH->fetch ();
$us_log1 = $row->send;
$us_log2 = $row->recive;
if ($us_log2 == $user_id) ($us_log2 = $us_log1);
<?php
require_once 'database_connection.php';
function authorize_user($groups = NULL) {
// Если не создан cookie-файл, проверять группы не нужно
if ((!isset($_COOKIE['user_id'])) || (!strlen($_COOKIE['user_id']) > 0)) {
header('Location: signin.php?' . 'error_message=Для просмотра этой страницы нужно зарегистрироваться.');
exit;
# Virtual Hosts
#
# Required modules: mod_log_config
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
"""
Application router decoretor.
"""
from functools import wraps
ROUTES = dict()
def bluprint_add_routes(blueprint, routes):
@exileed
exileed / deploy.yml
Created April 3, 2018 14:02
Ansible - Laravel 5.4+ deploy script
- hosts: all
vars:
branch: "master"
app_root: /www
app_repo: "[email protected]"
tasks:
- name: Enable maintenance mode
shell: php artisan down
args:
@exileed
exileed / pre-commit
Created April 3, 2018 14:11
php-cs-fixer pre commit hook
#!/usr/bin/env bash
echo "php-cs-fixer pre commit hook start"
PHP_CS_FIXER="bin/php-cs-fixer"
PHP_CS_CONFIG=".php_cs"
CHANGED_FILES=$(git diff --cached --name-only --diff-filter=ACM -- '*.php')
if [ -n "$CHANGED_FILES" ]; then
$PHP_CS_FIXER fix --config "$PHP_CS_CONFIG" $CHANGED_FILES;
git add $CHANGED_FILES;
@exileed
exileed / bitbucket-pipelines.yml
Created April 6, 2018 17:21
Bitbucket pipelines test + Ansible deploy script
image: php:7.1-fpm
pipelines:
default:
- step:
caches:
- composer
script:
# Update dependencies
- apt-get update
# Install dependencies