Skip to content

Instantly share code, notes, and snippets.

View fuale's full-sized avatar
🏠
Working from home

Farid Akhmedov fuale

🏠
Working from home
  • Russia, Kemerovo
View GitHub Profile
@fuale
fuale / AdminPanelWriteConfig.php
Last active May 31, 2018 18:02
Admin panel - create controller
<?php
/**
* Добавление в конфиг запись
*/
public function newRoute($POST)
{
$replace = "$1$2
\"{$POST['url']}\" => [
\t\"controller\" => \"{$POST['controller']}\",
\t\"action\" => \"{$POST['action']}\",
@fuale
fuale / nginx.conf
Last active June 17, 2018 13:30
Nginx config examples
#Для фреймворков - стандартный
server {
server_name [название];
root [путь];
index index.html index.php;
location /
{
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$
<?php
/* Laravel 5.6 */
/**
* model
* Upload image
*/
/*----- Don't use -----*/
function photo($file)
/**
- Create responsive font-size;
min = minimal font size
max = maximal font size
min_view = minimal view width
max_view = maximal view width
*/
responsive-font(min, max, min_view, max_view)
font-size: "calc(%spx + (%s - %s) * ((100vw - %spx) / (%s - %s)))" % (min max min min_view max_view min_view)
<?php
if (!function_exists('path_resolve')) {
/**
* Converts parts of the file path to the correct full path.
* @param string ...$parts
* @return string|string[]|null
*/
function path_resolve(string ...$parts): string
{
@fuale
fuale / js.js
Created July 17, 2019 18:38
Gradual reduction of the string. Smooth line reduction. Smooth narrowing of the string.
export function easeInOutQuad(t) {
return t * (2 - t);
}
/**
* Erase symbol one by one
* @param {Element} element
*/
export function smoothErase(element) {
const text = element.innerHTML;
@fuale
fuale / slide_puzzle.ts
Created February 12, 2022 23:13
slide puzzle
interface Position {
x: number;
y: number;
}
interface GridOptions {
elements: {
text: string;
}[];
}