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
@ponich
ponich / options.sh
Last active August 14, 2018 21:43
options.sh
#!/usr/bin/env bash
#option --h : Show help information
#option --p|php: PHP Version
#option --test|set-test-mode:Test mode enable
#option --DSDSA|dd:dsds
#option --v|--vv|--vvv|verbose
#option --debug
#option --http-root-path=/var/www :Http path
#option --set-mode= : Mode, require option
@ponich
ponich / proxy.js
Created July 25, 2018 17:57
javascript proxy object
// object
let obj = {};
let proxyObject = new Proxy(obj, {
set: function (obj, prop, value) {
obj[prop] = value;
return true;
},
get: function (target, name) {
import {Component, Input, OnInit} from "@angular/core";
@Component({
selector: 'avatar',
template: `
<div [ngStyle]="styles" title="{{name}}">
<span style="position: relative;float: left;top: 50%;left: 50%;transform: translate(-50%, -50%);">
{{shortName}}
</span>
</div>`
@ponich
ponich / logger.js
Created July 5, 2018 17:50
Logger status switcher
(function (original) {
console.enableLogging = function () {
console.log = original;
};
console.disableLogging = function () {
console.log = function () {
};
};
})(console.log);
@ponich
ponich / hold-time-before-action.js
Created June 25, 2018 19:43
hold time before action
/**
* Hold time
* @param alias
* @param fn
* @param time
*/
function holdTimeout(alias, fn, time) {
var storageKey = 'holdTimeoutStorage';
function _clear() {
@ponich
ponich / bootstrap-tabs-hash-on.js
Created June 25, 2018 19:41
Fix bootstrap tabs default active by hash
/**
* Fix bootstrap tabs default active by hash
*/
(function () {
// Javascript to enable link to tab
var url = document.location.toString();
if (url.match('#')) {
$('.nav-tabs a[href="#' + url.split('#')[1] + '"]').tab('show');
}
@ponich
ponich / BladeCompiler.php
Created June 25, 2018 01:50
BladeCompiler
<?php
namespace App\Libs;
use Illuminate\View\Compilers\BladeCompiler as LaravelBladeCompiler;
class BladeCompiler extends LaravelBladeCompiler
{
/**
@ponich
ponich / delete-confirm.js
Created June 21, 2018 06:46
Confirm before delete (need jquery)
$('a[data-delete]').bind('click', function (event) {
event.preventDefault();
// default
var element = event.currentTarget;
var item = $(element);
var message = 'Are you sure you want to delete this item?';
var href = '#';
if (item.length) {
@ponich
ponich / global.conf
Created June 21, 2018 00:59
Apache single global config for domains, use vhost_alias mod
# a2enmod vhost_alias
<VirtualHost *:80>
ServerName .ponich.com
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>
# SSL with wildcard
<IfModule mod_ssl.c>
@ponich
ponich / laravel-new
Created June 21, 2018 00:53
Create new laravel application. Use composser command ``laravel new`` from official package
#!/bin/bash -
WWW=/var/www/
LARAVEL_PATH=${1}
DOMAIN=$(echo "$LARAVEL_PATH" | cut -d "/" -f1)
MYSQL_USER=dev
MYSQL_DB=$(echo $DOMAIN | sed 's/\./_/g')
project_root(){
eval cd "${LARAVEL_PATH}"