Skip to content

Instantly share code, notes, and snippets.

View andrey-helldar's full-sized avatar
🧙‍♂️
It's never too late to get better

Andrey Helldar andrey-helldar

🧙‍♂️
It's never too late to get better
View GitHub Profile
@andrey-helldar
andrey-helldar / helper.php
Created December 6, 2017 14:41 — forked from Ellrion/helper.php
Сортировка ассоциативного массива в порядке указанном массивом ключей.
<?php
if (!function_exists('array_sort_by_keys_array')) {
/**
* Сортировка ассоциативного массива в порядке указанном массивом ключей.
*
* @param array $array Входной массив.
* @param array $sorter Массив ключей в нужном порядке.
*
* @return bool
@andrey-helldar
andrey-helldar / Backend.md
Last active October 31, 2020 13:26
Полезные пакеты

Backend

API

  • API (Package for standardizing the responses from the API of your applications)
  • API Doc Generator (An API documentation generator)

Documents

  • Excel (An eloquent way of importing and exporting Excel and CSV files for Laravel with the power of PHPExcel)
@andrey-helldar
andrey-helldar / package.json
Last active December 27, 2017 19:55
Пресет для работы с Laravel Mix
{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
@andrey-helldar
andrey-helldar / AppServiceProvider.php
Last active June 29, 2018 16:26 — forked from Ellrion/FlashMessageSender.php
Flash messages min service for Laravel (only backend)
<?php
namespace App\Providers;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
const queryString = require('query-string');
export default class UrlParams {
static urlOptions() {
return {
arrayFormat: 'bracket'
};
};
static set(params) {
@andrey-helldar
andrey-helldar / UsersOnlineService.php
Last active May 11, 2018 08:46
How many users are online on the current page.
<?php
namespace App\Services;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redis;
/**
* How many users are online on the current page.
*
@andrey-helldar
andrey-helldar / vin_mask.php
Created November 8, 2018 14:26
Masking the VIN of car
<?php
if (!function_exists('vin_mask')) {
function vin_mask(string $value)
{
$length = strlen($value);
$count = 8;
$start = mb_substr($value, 0, $count, 'UTF-8');
$end = mb_substr($value, $length - 2, null, 'UTF-8');
@andrey-helldar
andrey-helldar / app.js
Last active December 18, 2018 11:52
Resize images with javascript
function resize(path, canvas, width) {
var HERMITE = new Hermite_class();
var ctx = canvas.getContext('2d');
var img_w;
var img_h;
var current_size = false;
var img = new Image();
img.crossOrigin = 'Anonymous'; //cors support
img.onload = function () {
@andrey-helldar
andrey-helldar / flyHeader.js
Created January 15, 2019 07:56
fly header
$.fn.flyHead = function () {
function t() {
let t;
'absolute' == i.css('position') ? t = -a.height : (t = parseInt(i.css('top')) - n.step, t = -t > a.height ? -a.height : t), i.css({
top: t,
position: 'fixed'
})
}
function o() {
@andrey-helldar
andrey-helldar / with-ssl.vhost
Last active February 7, 2019 07:48
Nginx redirect from www to without www (nginx редирект с www на без www)
server {
listen <your-ip>:443 ssl;
server_name www.example.com;
ssl_certificate "/var/www/httpd-cert/myuser/example.com_le1.crtca";
ssl_certificate_key "/var/www/httpd-cert/myuser/example.com_le1.key";
ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:!NULL:!RC4;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;