Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
My blog. good-code.ru

Denis Belocerkovec belocer

💭
My blog. good-code.ru
View GitHub Profile
@belocer
belocer / gulpfile.js
Last active Feb 2, 2021
gulpfile LESS assembly
View gulpfile.js
const gulp = require("gulp"),
autoprefixer = require("gulp-autoprefixer"),
cleanCSS = require("gulp-clean-css"),
sourcemaps = require("gulp-sourcemaps"),
gcmq = require("gulp-group-css-media-queries"),
lessC = require("gulp-less"),
imagemin = require("gulp-imagemin"),
uglify = require("gulp-uglify"),
concat = require("gulp-concat"),
rename = require("gulp-rename"),
View pdo.php Hard Version
<?php
// Подключение к БД
$pdo = new PDO("mysql:host=localhost: dbname=test", "root", "");
// Готовим запрос
$sql = "SELECT * FROM tasks";
$statement = $pdo->prepare($sql); // подготовить запрос
$result = $statement->execute(); // вернет true || false // Запускает подготовленный запрос на выполнение
@belocer
belocer / WaterMark.php
Created Oct 31, 2018
WaterMark + PHP + GD
View WaterMark.php
/* WaterMark Водный знак */
// Сообщаем браузеру что ему даем картинку
header('Content-Type: image/jpeg'); // Работает для jpeg
$dir = __DIR__ . "/images/";
$arr_name_img = scandir($dir);
array_shift($arr_name_img); // Удалил .
array_shift($arr_name_img); // Удалил ..
@belocer
belocer / Work File System .txt PHP
Created Jan 26, 2019
Work File System .txt PHP
View Work File System .txt PHP
<?php
$dir = scandir("source");
$file = [];
for ($i = 2; $i < count($dir); $i++) {
$_arr = fopen("source/" .$dir[$i], "r");
array_push($file, file("source/" .$dir[$i]));
}
$arr = [];
$arr = call_user_func_array('array_merge', $file);
@belocer
belocer / index.html
Created May 18, 2019
Text Mask, Comic effect using blend modes
View index.html
<h1>Kaboom</h1>
@belocer
belocer / index.html
Created May 21, 2019
EventSource Comet
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<ul id="chat">
</ul>
@belocer
belocer / autoload.php
Created Jul 1, 2019
AutoLoad Classes
View autoload.php
<?php
spl_autoload_register(function ($ClassName){
$filePath = 'classes/' . $ClassName;
if (file_exists($filePath)) {
require_once $filePath;
}
});
spl_autoload_register(function ($ClassName){
$filePath = 'controller/' . $ClassName;
@belocer
belocer / .gitignore Laravel
Last active Jul 28, 2019
Laravel webpack.mix.js
View .gitignore Laravel
/node_modules
/public/hot
/public/build
/public/storage
/storage/*.key
/vendor
.env
.phpunit.result.cache
Homestead.json
Homestead.yaml
@belocer
belocer / index.html
Last active Sep 11, 2019
Класс для работы со звездами на сайте.
View index.html
<!-- HTML для класса -->
<span class="rating nowrap" id="stars3">
<i class="empty star" data-qty-star="1"></i>
<i class="empty star" data-qty-star="2"></i>
<i class="empty star" data-qty-star="3"></i>
<i class="empty star" data-qty-star="4"></i>
<i class="empty star" data-qty-star="5"></i>
<label for="stars_input3"></label>
<input type="text" name="star_rait_speed" id="stars_input3" value="0" class="review-qty" readonly>
</span>
@belocer
belocer / console.log.js
Created Sep 13, 2019
Узнать количество тегов на странице
View console.log.js
var all = document.getElementsByTagName("*");
console.log( all.length );