Skip to content

Instantly share code, notes, and snippets.

View j-tap's full-sized avatar
🍀
Development

Igor j-tap

🍀
Development
View GitHub Profile
/**
* HEX color to RGB color
* @param color
* @returns {number[]|null}
*/
function hexToRgbArr (color = null) {
if (color) {
let s = color.toString()
s = s.replace('#', '')

Установка

  • настройка переменных окружения
  • composer install
  • php artisan migrate
  • php artisan db:seed

Помощь

Настройка

/* Domain change */
// Plugin: Better Search Replace
// wp-config
// define('WP_HOME', 'http://amoren.vr9.ru');
// define('WP_SITEURL', 'http://amoren.vr9.ru');
<?php
$files = scandir('../app/Models');
$result = [];
foreach ($files as &$s)
{
if (strlen($s) > 2)
{
$name = explode('.', $s);
<?php
namespace App\Services;
/*
* Docs telegram bot methods:
* https://core.telegram.org/bots/api#available-methods
*/
class Telegram
@j-tap
j-tap / Laravel
Last active August 7, 2021 23:50
// Manual call to UserRequest validation
$userRequest = UserRequest::createFrom($request);
$validator = Validator::make($request->all(), $userRequest->rules());
$validatedData = $validator->validated(); // array
// Modify field in request
if ($request->filled('telegram'))
{
$request->merge([
'telegram' => ltrim($request->input('telegram'), '@'),
@j-tap
j-tap / macos-php-ipdate
Created September 29, 2020 11:11
Update PHP version on MacOS
Run it.
Then do the following steps below.
Update homebrew & upgrade
#brew update
#brew upgrade
Install php
#brew install php@7.2
Install the required PHP to your PATH
@j-tap
j-tap / Random-string
Created January 20, 2020 14:58 — forked from 6174/Random-string
Generate a random string in JavaScript In a short and fast way!
//http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
# Отменить последний коммит, но сохранить изменения:
$ git reset HEAD~
# Удалить последний коммит и откатить изменения:
$ git reset --hard HEAD~
# Привязать к новому проекту существующий репозиторий
git init
git add .
# если нужно изменить имя ветки (git branch -m main)
@j-tap
j-tap / browsersync-webpack.md
Created May 29, 2019 20:39 — forked from robinrendle/browsersync-webpack.md
Getting set up with Browsersync and Webpack

Fixing our local environment with Browsersync

Whenever we change our templates we still have to use our build script and this can get annoying. Thankfully with webpack-dev-server and BrowserSync we can fix this:

npm i -D browser-sync browser-sync-webpack-plugin webpack-dev-server

BrowserSync will act like a proxy, waiting for webpack to do its thing and then reloading the browser for us.