Skip to content

Instantly share code, notes, and snippets.

View ponich's full-sized avatar
🤡
be happy

Mykola Ponych ponich

🤡
be happy
View GitHub Profile
const callbackFn = callback && typeof callback ? callback : new Function();
@ponich
ponich / index.js
Last active August 3, 2022 17:02
TripperClicker
// ==UserScript==
// @name Simple Tampermonkey Script
// @version 1.0
// @match https://vk.com/classifieds?w=*
// @grant window.close
// ==/UserScript==
(() => {
const domObserver = new MutationObserver((mutations) => {
mutations.forEach(mutation => {
@ponich
ponich / grid.css
Created June 16, 2021 20:36
simple css 12 column grid
* {
box-sizing: border-box;
}
.row::after {
content: "";
clear: both;
display: table;
}
@ponich
ponich / app.js
Created March 18, 2021 13:14
get data from array by pagination
function getPagedData({data, page, size}) {
const skip = (page * size) - size;
return data.slice(skip, size + skip);
}
@ponich
ponich / helpers.php
Created November 25, 2020 10:41
laravel
<?php
if (!function_exists('getRouteUriByName')) {
/**
* Get route URI by route name
*
* @param string $name
* @return string
* @throws Exception
*/
@ponich
ponich / Mailable.php
Created September 16, 2020 11:18
Detect mailable class for laravel
<?php
namespace App\Mail;
use Illuminate\Contracts\Mail\Mailer as MailerContract;
use Illuminate\Mail\Mailable as BaseMailable;
abstract class Mailable extends BaseMailable
{
public function send(MailerContract $mailer)
@ponich
ponich / PHPSTORM XDEBUG ubuntu NGINX php7.2-fpm
Created October 28, 2019 23:51 — forked from me7media/PHPSTORM XDEBUG ubuntu NGINX php7.2-fpm
PHPSTORM XDEBUG ubuntu NGINX php7.2-fpm
sudo apt install php7.2-xdebug
sudo find / -name 'xdebug.so'
sudo gedit /etc/php/7.2/fpm/php.ini
sudo gedit /etc/php/7.2/cli/php.ini
sudo gedit /etc/php/7.2/cli/conf.d/20-xdebug.ini
[Xdebug]
; путь к файлу so, который мы временно сохаринили на шаге раньше
zend_extension=/usr/lib/php/20170718/xdebug.so
; остальные обязательные параметры
xdebug.profiler_enable_trigger=1
@ponich
ponich / update-token.js
Created August 16, 2019 14:48
Postman (update token pre-request)
let login = pm.variables.get("login");
let password = pm.variables.get("password");
pm.sendRequest({
url: pm.variables.get("baseUrl") + '/api/v1/Account/authorization',
method: 'POST',
header: {
"content-type": "application/json"
},
body: {
@ponich
ponich / vhost.conf
Created March 19, 2019 20:45
Apache Virtual Host
<VirtualHost *:80>
ServerName hostname.com
ServerAdmin email@gmail.com
ServerAlias www.hostname.com
DocumentRoot /var/www/hostname.com/public_html
<Directory /var/www/hostname.com/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
@ponich
ponich / get_object_value.js
Created September 4, 2018 19:05
Get value from object by key
/**
* Get value from object by key
* @param obj
* @param key
* @param defaultValue
* @returns {*}
*/
function getObjectValue(obj, key, defaultValue) {
defaultValue = defaultValue || null;